From: Andrey C. <sku...@us...> - 2006-11-15 10:37:37
|
Update of /cvsroot/eas-dev/eas/libeas In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv19212/libeas Modified Files: componentmanager.prg config.prg connection.prg dbmanager.prg execmanager.prg functions.prg messagemanager.prg protocol_raw.prg session.prg transportmanager.prg uimanager.prg Log Message: Unify log messages Index: componentmanager.prg =================================================================== RCS file: /cvsroot/eas-dev/eas/libeas/componentmanager.prg,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- componentmanager.prg 3 Nov 2006 16:12:08 -0000 1.3 +++ componentmanager.prg 15 Nov 2006 10:37:18 -0000 1.4 @@ -46,7 +46,7 @@ static function c_open( self, params ) local cfg - eDebug(15, "Component manager (CM): open") + eDebug( 25, "Open component manager" ) // Check config file cfg := EASGetConfig() @@ -65,22 +65,22 @@ component := params:receiver method := params:command - eDebug(15, "COMPONENT LOOKUP", component, iif("ARGS" $ params, '<'+valtype(params:args)+'>', '<no arguments>') ) + eDebug( 35, "Lookup", component, iif("ARGS" $ params, '<'+valtype(params:args)+'>', '<no arguments>') ) if .not. "ARGS" $ params .or. valtype(params:args)!="O" params:args := map() endif - eDebug(15, "CM lookup:", component, method) + eDebug( 25, "Lookup:", component, method ) // Query database q:db := OCMNG_REPOSITORY q:query := 'select id from '+OCMNG_COMMANDS_CLASS+' where component_name=="'+component+'" .and. name=="'+method+'";' cmds := sendMessage(,'sys.db', 'execute', q ) - eDebug(17, "DB returns:", cmds) + eDebug( 35, "DB returns:", cmds ) // TODO: ACL check if len(cmds) > 0 - eDebug(10, "CM found", cmds[1][1]) + eDebug( 25, "method found", cmds[1][1] ) return cmds[1][1] else self:lastError := "Method '"+method+"' of component '"+component+"' was not found" @@ -102,7 +102,7 @@ id := params:__id - eDebug(15, "CM execute", "'"+component+'.'+method+"'",', DB ID:', id) + eDebug( 25, "Execute", "'"+component+'.'+method+"'",', db id:', id) oErr := ErrorBlock({|e| break(e) }) @@ -110,19 +110,19 @@ q:id := id q:db := OCMNG_REPOSITORY obj := sendMessage(,'sys.db', 'get', q ) - eDebug(25, "CM object:", obj) + eDebug( 35, "Component object:", obj ) // Run method q:id := obj:form codeFile := sendMessage(,'sys.db', 'get', q ) if empty(codeFile) - eDebug(2, "CM: code file doesn't loaded to database") + eDebug( 5, "Code file doesn't loaded to database" ) return .F. else // Put code to temporary file or use existing file fName := "."+PATH_DELIM+"cache"+PATH_DELIM+codeFile:id+".po" - eDebug(15, "CM opens", fName) + eDebug( 25, "CM opens", fName ) endif if .T. //.not. file(fName) // DEBUG: all occurences @@ -134,16 +134,16 @@ // Use code fBlock := loadBlock(fName) if valType(fBlock) != "B" - eDebug(2, "CM: Error load codeblock from:",fName) + eDebug( 5, "Unable load codeblock from:", fName ) return NIL endif - eDebug(15, "CM eval:", method) + eDebug( 35, "Eval:", method ) ret := eval(fBlock, method, params:args) - eDebug(19, "CM returns:", ret) + eDebug( 35, "Returns:", ret ) recover using oErr - eDebug(1, "CM error:", errorMessage(oErr)) + eDebug( 5, "Error:", errorMessage(oErr) ) return "Error execute: "+errorMessage(oErr) end sequence @@ -153,33 +153,33 @@ /** Get component list */ static function c_list( self, params ) local q:=map(), a - eDebug(15, "CM list") + eDebug( 25, "Component ist" ) // Query database q:db := OCMNG_REPOSITORY q:query := "select component_name from "+OCMNG_COMPONENT_CLASS+";" a := sendMessage(,'sys.db', 'execute', q ) - eDebug(17, "DB returns:", a) + eDebug( 35, "DB returns:", a ) return a /** Get component commands list */ static function c_commands( self, params ) local q:=map(), a, i, j, name, res:=array(0), cname - eDebug(15, "CM commands") + eDebug( 25, "Component commands" ) // Query database q:db := OCMNG_REPOSITORY q:query := "select component_name,name from "+OCMNG_COMMANDS_CLASS+";" a := sendMessage(,'sys.db', 'execute', q ) - eDebug(17, "DB returns:", a) + eDebug( 35, "DB returns:", a ) for i in a name := i[1] q:id := i[2] q:db := OCMNG_REPOSITORY obj := sendMessage(,'sys.db', 'get', q ) - eDebug(25, "CM object:", obj) + eDebug( 35, "Object:", obj ) cname := iif( valtype(obj)=='O', cname:name, NIL ) aadd( res, { name, cname } ) next @@ -190,7 +190,7 @@ static function c_get( self, params ) local q:=map(), component, a, obj:=NIL - eDebug(15, "CM get") + eDebug( 25, "Component get") if 'ARGS' $ params .and. 'NAME' $ params:args component := params:args:name else @@ -201,7 +201,7 @@ q:db := OCMNG_REPOSITORY q:query := 'select id from '+OCMNG_COMPONENT_CLASS+' where component_name=="'+component+'";' a := sendMessage(,'sys.db', 'execute', q ) - eDebug(17, "DB returns:", a) + eDebug( 35, "DB returns:", a ) if len(a) == 0 self:lastError := "Component '"+component+"' was not found" @@ -211,6 +211,6 @@ q:id := a[1] q:db := OCMNG_REPOSITORY obj := sendMessage(,'sys.db', 'get', q ) - eDebug(25, "CM object:", obj) + eDebug( 35, "Object:", obj ) return obj Index: config.prg =================================================================== RCS file: /cvsroot/eas-dev/eas/libeas/config.prg,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- config.prg 2 Jun 2006 14:32:45 -0000 1.1 +++ config.prg 15 Nov 2006 10:37:18 -0000 1.2 @@ -19,6 +19,78 @@ static config static debugLevel:=MAX_DEBUG_LEVEL +/** Debug level policy: + +Group by severity: + 1-10 errors + 11-20 warnings + 21-30 information + 31-40 data + 41-255 other + +Group by module: + ?1 executed program + ?2 message manager layer + ?3 database layer + ?4 execute layer + ?5 component manager layer + ?6 transport layer + ?7 session + ?8 UI layer + ?9 reserved for components + ?0 other + +*/ + + +static eDebugCodes := { ; + ; // Errors + { 1, "program.error" }, ; + { 2, "message.error" }, ; + { 3, "db.error" }, ; + { 4, "execute.error" }, ; + { 5, "components.error" }, ; + { 6, "transport.error" }, ; + { 7, "session.error" }, ; + { 8, "ui.error" }, ; + { 9, "component.error" }, ; + { 10, "other.error" }, ; + ; // Warnings + { 11, "program.warning" }, ; + { 12, "message.warning" }, ; + { 13, "db.warning" }, ; + { 14, "execute.warning" }, ; + { 15, "components.warning" }, ; + { 16, "transport.warning" }, ; + { 17, "session.warning" }, ; + { 18, "ui.warning" }, ; + { 19, "component.warning" }, ; + { 20, "other.warning" }, ; + ; // Information + { 21, "program.info" }, ; + { 22, "message.info" }, ; + { 23, "db.info" }, ; + { 24, "execute.info" }, ; + { 25, "components.info" }, ; + { 26, "transport.info" }, ; + { 27, "session.info" }, ; + { 28, "ui.info" }, ; + { 29, "component.info" }, ; + { 30, "other.info" }, ; + ; // Data + { 31, "program.data" }, ; + { 32, "message.data" }, ; + { 33, "db.data" }, ; + { 34, "execute.data" }, ; + { 35, "components.data" }, ; + { 36, "transport.data" }, ; + { 37, "session.data" }, ; + { 38, "ui.data" }, ; + { 39, "component.data" }, ; + { 40, "other.data" }, ; +} + + function EASGetConfig() return config @@ -105,7 +177,7 @@ /* Put value to debug output */ function eDebug() // level, values... - local pC, level, i, s:='' + local pC, level, i, s:='', pN, module:='' pC := pcount() // No parameters: do nothing @@ -113,7 +185,7 @@ return NIL endif - level := param(1) + level := 0 + param(1) if valtype(level) != 'N' level := DEFAULT_DEBUG_LEVEL endif @@ -124,7 +196,16 @@ s := s + var2log( param(i) ) + ' ' next s := left(s, len(s)-1) - ?? s + chr(10) + + // Check severity and module for level + pN := ascan( eDebugCodes, {|e| e[1] == level } ) + if pN > 0 + module := eDebugCodes[pN][2] + ': ' + endif + + // Output debug message + ?? module + s + chr(10) + endif return NIL Index: connection.prg =================================================================== RCS file: /cvsroot/eas-dev/eas/libeas/connection.prg,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- connection.prg 2 Jun 2006 14:32:45 -0000 1.1 +++ connection.prg 15 Nov 2006 10:37:18 -0000 1.2 @@ -26,7 +26,7 @@ case "raw" // Base raw protocol obj := EASRAWProtocol( params ) otherwise - eDebug(5, "WARNING: unknown protocol '"+params:protocol+"'") + eDebug( 16, "Unknown protocol '"+params:protocol+"'") obj := NIL endswitch Index: dbmanager.prg =================================================================== RCS file: /cvsroot/eas-dev/eas/libeas/dbmanager.prg,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- dbmanager.prg 3 Nov 2006 16:12:08 -0000 1.2 +++ dbmanager.prg 15 Nov 2006 10:37:18 -0000 1.3 @@ -52,7 +52,7 @@ aadd(openDBs, i[1]) next - eDebug(15, "Open databases:", openDBs) + eDebug( 23, "Open databases:", openDBs ) return NIL @@ -75,11 +75,11 @@ params:db := '' endif - eDebug(15, "sys.db.executeExt.db", params:db ) + eDebug( 23, "sys.db.executeExt.db", params:db ) res := codb_execute( self:db, params:query, params:db ) if codb_get_error( res ) != NIL - eDebug(2, "sys.db.failed:", codb_get_error( res )) + eDebug( 3, "sys.db.failed:", codb_get_error( res ) ) sendMessage(,,'sys.db.failed', res ) return array(0) endif @@ -97,7 +97,7 @@ endif res := codb_get_object( self:db, params:id, params:db ) if codb_get_error( res ) != NIL - eDebug(2, "sys.db.failed:", codb_get_error( res )) + eDebug( 3, "sys.db.failed:", codb_get_error( res ) ) sendMessage(,,'sys.db.failed', res ) return array(0) endif @@ -111,7 +111,7 @@ endif res := codb_put_object( self:db, params:obj, params:db, params:class ) if codb_get_error( res ) != NIL - eDebug(2, "sys.db.failed:", codb_get_error( res )) + eDebug( 3, "sys.db.failed:", codb_get_error( res ) ) sendMessage(,,'sys.db.failed', res ) return array(0) endif @@ -125,13 +125,13 @@ endif res := codb_get_object( self:db, params:id, params:db) if codb_get_error( res ) != NIL - eDebug(2, "sys.db.failed:", codb_get_error( res )) + eDebug( 3, "sys.db.failed:", codb_get_error( res ) ) sendMessage(,,'sys.db.failed', res ) return NIL endif obj := codb_get_result( res ) if valtype(obj) != 'O' .or. .not. upper(params:attr) $ obj - eDebug(2, "sys.db.failed:", codb_get_error( res )) + eDebug( 3, "sys.db.failed:", codb_get_error( res ) ) sendMessage(,,'sys.db.failed', res ) return NIL endif Index: execmanager.prg =================================================================== RCS file: /cvsroot/eas-dev/eas/libeas/execmanager.prg,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- execmanager.prg 3 Nov 2006 16:12:08 -0000 1.3 +++ execmanager.prg 15 Nov 2006 10:37:18 -0000 1.4 @@ -39,9 +39,9 @@ /** Open manager */ static function c_open( self, params ) - eDebug(15, "Execute layer: start component manager") + eDebug( 24, "Start component manager" ) self:cManager:open( params ) - eDebug(15, "Execute layer: component manager is ready") + eDebug( 24, "Component manager is ready" ) return NIL /** Close manager */ @@ -68,25 +68,25 @@ i := ascan( self:commands, {|e| e[1]==params:receiver .and. e[2]==params:command } ) if i > 0 // Execute command - eDebug(15, "EXEC COMMAND '"+params:receiver+"."+params:command+"'...") + eDebug( 24, "Execute command '"+params:receiver+"."+params:command+"'..." ) bCode := self:commands[i][3] vRet := eval( bCode, params:args ) - eDebug(20, "EXEC '"+params:receiver+"."+params:command+"' returns:", vRet) + eDebug( 34, "Execute '"+params:receiver+"."+params:command+"' returns:", vRet ) return vRet else self:lastError := "ERROR: command '"+params:command+"' for '"+params:receiver+"' not found" - eDebug(2, self:lastError) + eDebug( 4, self:lastError ) return NIL endif elseif ascan( self:commands, {|e| e[1]=='sys.db' } ) > 0 .and. .not. empty (id:=self:cManager:lookup( params )) - eDebug(15, "EXEC COMPONENT COMMAND:",params:receiver,params:command,"...") + eDebug( 24, "Execute component command:",params:receiver,params:command,"..." ) params:__id := id vRet := self:cManager:execute( params ) - eDebug(20, "EXEC COMPONENT '"+params:command+"' returns:", vRet) + eDebug( 34, "Execute component '"+params:command+"' returns:", vRet ) return vRet else self:lastError := iif(empty(self:cManager:lastError),"ERROR: component '"+params:receiver+"' not found",self:cManager:lastError) - eDebug(2, "EXEC:", self:lastError) + eDebug( 4, self:lastError ) //eDebug(5, var2log(self:getCommands(),2,.T.)) return NIL endif @@ -94,17 +94,17 @@ endif // Execute signal handler - eDebug(15, "EXEC EVENT:", params:command) + eDebug( 24, "Event:", params:command ) i := ascan( self:events, {|e| e[1]==params:command } ) if i > 0 slot_list := self:events[i][2] for j:=1 to len(slot_list) - eDebug(15, "EVENT: ",params:command) + eDebug( 24, "Event handler found: ", params:command ) bCode := slot_list[j] eval( bCode, params:args ) next else - eDebug(5, "WARNING: there are no handlers for event '"+params:command+"'") + eDebug( 14, "Tthere are no handlers for event '"+params:command+"'" ) endif return NIL @@ -194,7 +194,7 @@ endif elseif "COMPONENT" $ params .and. valtype(params:component) == 'C' i := ascan( self:commands, {|e| e[1]==params:component .and. e[2]==params:command } ) -/* eDebug(11, "Remove command:", params:component+'.'+params:command,iif(i>0,'OK','FAILED') ) +/* eDebug( 24, "Remove command:", params:component+'.'+params:command,iif(i>0,'OK','FAILED') ) aa := self:getCommands() for j in self:commands ?? chr(9),j[1],chr(9),j[2],chr(10) Index: functions.prg =================================================================== RCS file: /cvsroot/eas-dev/eas/libeas/functions.prg,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- functions.prg 3 Nov 2006 16:12:08 -0000 1.3 +++ functions.prg 15 Nov 2006 10:37:18 -0000 1.4 @@ -23,7 +23,7 @@ endif if pc < 2 - eDebug(3, "Error in component(): must be 2 or more parameters") + eDebug( 10, "component(): must be 2 or more parameters" ) return NIL elseif pc == 3 args := iif(empty(params), param(3), params[3]) @@ -45,7 +45,7 @@ // Read answer from server ret := sendMessage(,'sys.transport.default', 'read') - eDebug(15, "component '"+p1+"."+p2+"':", seconds()-tm) + eDebug( 30, "component(): '"+p1+"."+p2+"':", seconds()-tm ) return ret /* Send message to local component */ @@ -54,19 +54,19 @@ //eDebug(7, "lcomponent() call") if pc < 2 - eDebug(3, "Error in component(): must be 2 or more parameters") + eDebug( 10, "lcomponent(): must be 2 or more parameters" ) return NIL elseif pc == 3 .and. valtype() == 'O' - //eDebug(7, "lcomponent() - pass map as argument") + //eDebug( 30, "lcomponent() - pass map as argument" ) args := param(3) elseif pc > 3 args := map() - //eDebug(7, "lcomponent() - pass",pc,"parameters") + //eDebug( 30, "lcomponent() - pass",pc,"parameters" ) for i:=3 to pc step 2 args[upper(param(i))] := iif(i+1>pc,NIL,param(i+1)) next endif - //eDebug(5, "lcomponent():", args, iif("PARAMS" $ args, args:params, "") ) + //eDebug( 40, "lcomponent():", args, iif("PARAMS" $ args, args:params, "") ) // Prepare message contents ret := sendMessage( , param(1), param(2), args, NIL ) return ret @@ -96,11 +96,11 @@ types := upper(substr(e, sep+1 )) endif if .not. name $ value // Check named parameter in value - eDebug(5, "ASSERT: not parameter '"+name_r+"':",value) + eDebug( 20, "assert(): Not parameter '"+name_r+"':", value ) return .T. endif if .not. valtype(value[name]) $ types // Check allowed types of parameters - eDebug(5, "ASSERT: bad type of '"+name_r+"': "+valtype(value[name])+", expected '"+types+"':",value[name]) + eDebug( 20, "assert(): Bad type of '"+name_r+"': "+valtype(value[name])+", expected '"+types+"':", value[name] ) return .T. endif next @@ -155,7 +155,7 @@ real := strtran(name, "/", "_") // Get file from server - eDebug(15, "getResource(): retrieve", name) + eDebug( 30, "getResource(): retrieve", name) oErr := errorBlock({|e| break(e) }) begin sequence lFile := file(real) @@ -168,17 +168,17 @@ endif f := fcreate(real) if f < 0 - eDebug(2, "getResource(): Error open file for writing:", ferror(), ferrorstr()) + eDebug( 10, "getResource(): Error open file for writing:", ferror(), ferrorstr() ) return NIL endif l := fwrite(f, content) - eDebug(15, "getResource(): wrote", real, l, "bytes") + eDebug( 30, "getResource(): wrote", real, l, "bytes" ) fclose(f) else - eDebug(15, "getResource():", real, "(cached)") + eDebug( 30, "getResource():", real, "(cached)" ) endif recover using oErr - eDebug(2, "RESOURCE: Internal error:",errorMessage(oErr)) + eDebug( 10, "getResource(): Internal error:",errorMessage(oErr)) return o end sequence @@ -199,9 +199,9 @@ local oErr oErr := errorBlock({|e| break(e) }) begin sequence - eDebug(5, "TESTOUT():", w:getSelectionId()) + eDebug( 40, "testout():", w:getSelectionId() ) recover using oErr - eDebug(2, "TESTOUT(): Internal error:",errorMessage(oErr)) + eDebug( 10, "testout(): Internal error:",errorMessage(oErr) ) end sequence return NIL @@ -222,11 +222,11 @@ /* Return XML-safe string */ function safeXML( string ) - //eDebug( 25, "Before XMLization:", string ) + //eDebug( 40, "Before XMLization:", string ) string := strtran( string, '&', '&' ) string := strtran( string, '<', '<' ) string := strtran( string, '>', '>' ) string := strtran( string, '"', '"' ) string := strtran( string, "'", ''' ) - //eDebug( 25, "After XMLization:", string ) + //eDebug( 40, "After XMLization:", string ) return string Index: messagemanager.prg =================================================================== RCS file: /cvsroot/eas-dev/eas/libeas/messagemanager.prg,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- messagemanager.prg 16 Jun 2006 15:22:20 -0000 1.2 +++ messagemanager.prg 15 Nov 2006 10:37:18 -0000 1.3 @@ -58,34 +58,34 @@ /** Open manager */ static function c_open( self, params ) // params: ignored - eDebug(10, "MM: Activate layers...") + eDebug( 22, "Activate layers..." ) if self:type == EAS_SERVER // Server - eDebug(10, "RUN SERVER...") - eDebug(15, "Database layer...") + eDebug( 22, "Run SERVER...") + eDebug( 22, "Database layer..." ) self:db:open(params) - eDebug(15, "Execute layer...") + eDebug( 22, "Execute layer..." ) self:exec:open(params) - eDebug(15, "Transport layer...") + eDebug( 22, "Transport layer..." ) self:transport:open(params) else // Client - eDebug(10, "RUN CLIENT...") -// eDebug(15, "Database layer...") + eDebug( 22, "Run CLIENT..." ) +// eDebug( 22, "Database layer..." ) // self:db:open(params) - eDebug(15, "Execute layer...") + eDebug( 22, "Execute layer..." ) self:exec:open(params) - eDebug(15, "UI layer...") + eDebug( 22, "UI layer..." ) self:ui:open(params) - eDebug(15, "Transport layer...") + eDebug( 22, "Transport layer..." ) self:transport:open(params) endif - eDebug(10, "MM: Layers are activated.") + eDebug( 22, "MM: Layers are activated." ) return NIL /** Close manager */ static function c_close( self, params ) // params: ignored - eDebug(10, "MM: Close layers...") + eDebug( 22, "Close layers..." ) if self:type == EAS_SERVER // Server self:transport:close(params) self:exec:close(params) @@ -96,7 +96,7 @@ self:ui:close(params) self:db:close(params) endif - eDebug(10, "MM: Layers are closed.") + eDebug( 22, "Layers are closed." ) return NIL /** Process message from sender */ @@ -112,11 +112,15 @@ // Run command on execute layer ret := self:exec:execute( params ) - eDebug(25, "MM:process() on execute returns:", ret) + eDebug( 32, "::process() on execute returns:", ret ) if ret == NIL .and. self:exec:lastError != NIL ret := map() ret:error := self:exec:lastError + + // Pass error to administrator + lcomponent( "errorlog", "add", "error", ret:error ) + endif // If it isn't event (defined receiver): return result @@ -126,7 +130,7 @@ msg:receiver := params:sender msg:command := NIL msg:args := ret - eDebug(15, "MM:process(): pass result to sender") + eDebug( 22, "::process(): pass result to sender" ) self:process( msg ) else // Sender undefined: straight return return ret @@ -138,7 +142,7 @@ return NIL /*-------------------------------------------------------------------------*/ -/* Global functions */ +/* Global functions */ /*-------------------------------------------------------------------------*/ /** Set slot for event */ @@ -158,7 +162,7 @@ local params:=map() msg_m := iif(valtype(msg_m) != 'O', global_msg, msg_m) - eDebug(11, "setCommand():", component, command) + eDebug( 24, "setCommand():", component, command ) if valtype(msg_m) == 'O' .and. valtype(msg_m:exec) == 'O' params:component := component params:command := command @@ -172,7 +176,7 @@ local params:=map() msg_m := iif(valtype(msg_m) != 'O', global_msg, msg_m) - eDebug(11, "removeCommand():", component, command) + eDebug( 24, "removeCommand():", component, command ) if valtype(msg_m) == 'O' .and. valtype(msg_m:exec) == 'O' params:component := component params:command := command @@ -188,12 +192,12 @@ params:command := command params:args := args params:sender := sender - eDebug(10, "MM: sendMessage():", params ) + eDebug( 22, "send", params ) if "ARGS" $ params - eDebug(17, "MM: parameters:", params:args ) + eDebug( 32, "send parameters:", params:args ) endif ret := msg_m:process( params ) - eDebug(25, "MM: sendMessage() returns:", ret) + eDebug( 32, "returns:", ret) return ret /** Create empty message */ Index: protocol_raw.prg =================================================================== RCS file: /cvsroot/eas-dev/eas/libeas/protocol_raw.prg,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- protocol_raw.prg 17 Jun 2006 17:00:36 -0000 1.4 +++ protocol_raw.prg 15 Nov 2006 10:37:18 -0000 1.5 @@ -67,7 +67,7 @@ self:socket:type := params:transport self:socket:role := lower(params:role) - eDebug(15, "Open RAW connection:", params) + eDebug( 26, "Open RAW connection:", params ) if 'LISTENTIMEOUT' $ params self:socket:lTimeout := params:listenTimeout @@ -98,24 +98,24 @@ // Open connection if self:socket:role == 'server' // Server mode: accept clients connections // Bind to port - eDebug(10, "NETWORK: Bind to port...") + eDebug( 26, "Bind to port..." ) if (self:socket:handle := tcpListen( self:socket:port, self:socket:lTimeOut )) == -1 self:error := self:socket:name+": error listen on port "+toString(self:socket:port)+": "+ferrorStr() args:error := self:error sendMessage(,,"sys.transport.failed",args) - eDebug(2, self:error) + eDebug( 6, self:error ) return .F. endif - eDebug(10, "NETWORK: Accept connections...") + eDebug( 26, "Accept connections..." ) /*===================================================================*/ /* Main server loop */ /*===================================================================*/ do while( .T. ) if (session := tcpAccept( self:socket:handle, self:socket:aTimeOut )) != -1 // Create new session - eDebug(10, "NETWORK: Start session: ", session) + eDebug( 26, "Start new session: ", session) threadId := start(@session_open(), self, session) // Begin new thread - eDebug(15, "NETWORK: Ready for new connection") + eDebug( 26, "Ready for new connection") endif sleep(0.01) enddo @@ -127,13 +127,13 @@ self:socket:host := params:host endif if( (self:socket:handle := tcpConnect( self:socket:host, self:socket:port, self:socket:lTimeout )) == -1 ) - eDebug(1, "NETWORK: Failed to open client connection:", ferrorStr()) + eDebug( 6, "Failed to open client connection:", ferrorStr()) self:error := self:socket:name+": error connect: "+ferrorStr() args:error := self:error sendMessage(,,"sys.transport.failed",args) return .F. else - eDebug(10, "NETWORK: Open client connection:", self:socket:handle) + eDebug( 26, "Open client connection:", self:socket:handle) setCommand(, 'sys.transport.'+params:name, 'read', {|p| self:deserialize(self:read(p)) } ) setCommand(, 'sys.transport.'+params:name, 'write', {|p| self:write(self:serialize(p)) } ) setCommand(, 'sys.transport.default', 'read', {|p| self:deserialize(self:read(p)) } ) @@ -181,7 +181,7 @@ */ oRet:data := var2str( params:data ) oRet:size := len(oRet:data) - eDebug(20, "NETWORK: serialize:", oRet) + eDebug( 36, "Serialize:", oRet ) return oRet /** Deserialize packet */ @@ -195,8 +195,8 @@ oRet := str2var(params:data) - eDebug(20, "NETWORK: deserialize:", oRet) - eDebug(10, "NETWORK: deserialize:", seconds()-sec, "sec") + eDebug( 36, "Deserialize:", oRet ) + eDebug( 26, "Deserialize:", seconds()-sec, "sec" ) return oRet /** Read data */ @@ -216,7 +216,7 @@ params:session := self:socket:handle endif - eDebug(20, "NETWORK: Read from socket...") + eDebug( 36, "Read from socket..." ) // Check params if assertParameters( params, { 'session:N' } ) @@ -224,7 +224,7 @@ endif nSize := self:socket:readBlock nSize := 6000 - //eDebug(20, "NETWORK: buffer length:", nSize) + //eDebug( 36, "Buffer length:", nSize ) cBuf := space(nSize) @@ -236,7 +236,7 @@ // Empty socket return NIL else - eDebug(20, "NETWORK: Read to buffer:", params:session, nRead, left(cBuf, nRead)) + eDebug(36, "Read to buffer:", params:session, nRead, left(cBuf, nRead) ) cBuffer := left(cBuf, nRead) nTotal := nRead if nRead == nSize @@ -248,14 +248,14 @@ endif endif recover using oErr - eDebug(2, "NETWORK: read error") + eDebug( 6, "Read error") cBuffer := '' nTotal := 0 end sequence oData:data := cBuffer oData:size := nTotal - eDebug(10, "NETWORK: Read", oData:size, "bytes,", seconds()-sec, "sec") + eDebug( 26, "Read", oData:size, "bytes,", seconds()-sec, "sec" ) return oData @@ -274,7 +274,7 @@ return .F. endif - eDebug(10, "NETWORK: Write to socket...") + eDebug( 26, "Write to socket..." ) oErr := ErrorBlock({|e| break(e) }) begin sequence @@ -290,5 +290,5 @@ return .F. end sequence - eDebug(10, "NETWORK: Wrote",nSended,"bytes") + eDebug( 26, "Wrote",nSended,"bytes" ) return .T. Index: session.prg =================================================================== RCS file: /cvsroot/eas-dev/eas/libeas/session.prg,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- session.prg 17 Jun 2006 17:00:36 -0000 1.3 +++ session.prg 15 Nov 2006 10:37:18 -0000 1.4 @@ -61,7 +61,7 @@ static function c_login( self, params ) local oWrite := map() - eDebug( 5, "SECURITY: LOGIN:", params) + eDebug( 27, "Login:", params) self:access := .F. // Authenticate user @@ -71,10 +71,10 @@ elseif valtype(self:access) != 'L' self:access := .F. // Access denied on any auth component internal error endif - eDebug(10, self:name+" SECURITY: access: ",self:access ) + eDebug( 27, "Access for "+self:name+": ",self:access ) oWrite:answer := self:access - eDebug(16, "Answer:", oWrite:answer) + eDebug( 27, "Answer:", oWrite:answer ) return oWrite /** Close session */ @@ -82,7 +82,7 @@ removeCommand(, 'sys.transport.'+self:name, 'login' ) removeCommand(, 'sys.transport.'+self:name, 'close' ) self:connection:closeSession( self ) - eDebug(15, "Session closing.") + eDebug( 27, "Session closing." ) return NIL /** Read data */ @@ -94,13 +94,13 @@ params:session := self:handle oRaw := self:connection:read( params ) if self:connection:errno == 32 // Client connection was broken - eDebug(13, "Connection was broken from client" ) + eDebug( 17, "Connection was broken from client" ) return 2 endif if empty(oRaw) return 0 endif - eDebug( 20, "Session read:", oRaw) + eDebug( 37, "Session read:", oRaw ) // Deserialize answer obj := self:connection:deserialize( oRaw ) if .not. empty(obj) .and. .not. assertParameters( obj, { 'receiver:UC', 'command:C', 'args:UAO', 'sender:UC' } ) @@ -110,7 +110,7 @@ // TODO: use isolated message managers per session oMsg := NIL // Use global message manager - eDebug(10, "ARGS:", obj:args) + eDebug( 27, "Arguments:", obj:args ) // Translate session fo sys.transport if lower(obj:receiver) == 'sys.transport.default' @@ -131,14 +131,13 @@ self:write( oWrite ) // If access denied then close connection - eDebug(2, self:name+" ACCESS:",self:access) + eDebug( 7, "Access for "+self:name+":", self:access ) if .not. self:access - //?? "SESSION CLOSE: access denied.&\n" return 2 // Close session endif else - eDebug(1, "Session: Invalid object received.") + eDebug( 17, "Invalid object received.") endif return 1 @@ -147,14 +146,14 @@ // params: data:O local oData, oError - eDebug( 20, "Session write") + eDebug( 27, "Session write") if params == NIL params := map() params:data := NIL endif if .not. valtype( params ) $ 'AO' .or. ( (oData := self:connection:serialize( params )) == NIL ) - eDebug( 1, "ERROR preparing data for write. Sending message with data.") + eDebug( 17, "ERROR preparing data for write. Sending message with data.") oError := map() oError:data := params oData := self:connection:serialize( oError ) @@ -171,6 +170,6 @@ if valtype(self:messages) == 'O' ret := sendMessage(self:messages, receiver, command, args, sender ) else - eDebug( 1, "Session error:",command,args ) + eDebug( 17, "Error:", command, args ) endif return \ No newline at end of file Index: transportmanager.prg =================================================================== RCS file: /cvsroot/eas-dev/eas/libeas/transportmanager.prg,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- transportmanager.prg 6 Jun 2006 13:29:30 -0000 1.2 +++ transportmanager.prg 15 Nov 2006 10:37:18 -0000 1.3 @@ -34,10 +34,10 @@ if valtype(cfg) != 'O' .or. cfg:className != "EASConfig" return NIL endif - eDebug(10, "TRANSPORT: Connection from command line:",cfg:connection) + eDebug( 26, "Connection from command line:", cfg:connection ) if cfg:connection != NIL // Connection in command line - eDebug(10, "TRANSPORT: Create connection from string:",cfg:connection) + eDebug( 26, "TRANSPORT: Create connection from string:", cfg:connection ) // Fill connection parameters // Parse string: protocol://user:password@host:port/db cstr := alltrim(cfg:connection) @@ -66,11 +66,11 @@ // Create connection object c := EASConnection( pset ) if c != NIL - eDebug(10, "TRANSPORT: Connection from string is created") + eDebug( 26, "Connection from string is created") aadd(obj:connectionNames, pset:name) aadd(obj:connections, c) else - eDebug(1, "TRANSPORT: Failed to create connection from command line") + eDebug( 6, "Failed to create connection from command line") endif endif @@ -110,7 +110,7 @@ // No connections: send event 'sys.transport.failed' if len( self:connections ) == 0 - eDebug(1, "TRANSPORT: no connections") + eDebug( 6, "No connections" ) sendMessage(,,'sys.transport.failed') return NIL endif @@ -136,7 +136,7 @@ endif recover using oErr - eDebug(1, "Open connection error:",errorMessage(oErr)) + eDebug( 6, "Open connection error:", errorMessage(oErr) ) return o end sequence @@ -148,11 +148,11 @@ oErr := errorBlock({|e| break(e) }) begin sequence - eDebug(10, "Begin thread in connection_open()") + eDebug( 26, "Begin thread in connection_open()" ) connection := oCurConn ret := connection:open() recover using oErr - eDebug(1, "Open connection:",errorMessage(oErr)) + eDebug( 6, "Open connection:", errorMessage(oErr) ) return o end sequence return ret Index: uimanager.prg =================================================================== RCS file: /cvsroot/eas-dev/eas/libeas/uimanager.prg,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- uimanager.prg 3 Nov 2006 16:12:08 -0000 1.3 +++ uimanager.prg 15 Nov 2006 10:37:18 -0000 1.4 @@ -55,7 +55,7 @@ // Check config file cfg := EASGetConfig() if valtype(cfg) == 'O' .and. cfg:className == "EASConfig" .and. .not. empty(cfg:driver) - eDebug(10, "UI: Used driver:", cfg:driver) + eDebug( 28, "Used driver:", cfg:driver ) useDriver( cfg:driver ) endif @@ -108,21 +108,21 @@ // Get form from server vRet := component('form', 'get', params) - eDebug(10, "UI: open form '"+name+"':", len(vRet), 'bytes. ID:', objId) + eDebug( 28, "Open form '"+name+"':", len(vRet), 'bytes. Id:', objId ) //eDebug(19, vRet) if empty(vRet) - eDebug(1, "ERROR: cannot open empty form") + eDebug( 8, "ERROR: cannot open empty form" ) return .F. endif if valtype(vRet) == 'O' .and. 'ERROR' $ vRet - eDebug(1, "ERROR on form open:", vRet:error) + eDebug( 8, "ERROR on form open:", vRet:error ) return .F. endif if valtype(vRet) <> 'C' - eDebug(1, "ERROR on form open: return value must be string") + eDebug( 8, "ERROR on form open: return value must be string" ) return .F. endif @@ -135,19 +135,19 @@ parent := self:main endif - eDebug( 16, "UI: form parsing..." ) + eDebug( 28, "Form is parsing..." ) // Process and show form form := UIForm( name, parent ) if SHOW_FORMS - eDebug(17, "UI: FORM CONTENT:", vRet ) + eDebug(38, "Form content:&\n", vRet ) endif win := form:parseString(vRet) - eDebug( 16, "UI: window is created...", valtype(win) ) + eDebug( 28, "Window is created...", valtype(win) ) if win == NIL - eDebug(3, "UI: Error parse form") + eDebug( 8, "Error parse form" ) return .F. elseif self:main == NIL self:main := win @@ -156,7 +156,7 @@ win:objId := objId win:creator := parent win:returnAction := action - // eDebug(15, "FORM name:", formName, "type:", formType, "id:", objId, "action:", action) + //eDebug( 28, "FORM name:", formName, "type:", formType, "id:", objId, "action:", action ) // Get class name t := form:oXml:XPath("/head/class") @@ -174,11 +174,11 @@ win:show() recover using oErr - eDebug(1, "UI EXCEPTION:",errorMessage(oErr)) + eDebug( 8, "Internal error:",errorMessage(oErr) ) return o end sequence - eDebug(10, "UI: end open form") + eDebug( 28, "End open form" ) return .T. /** Close form */ @@ -206,7 +206,7 @@ // Put object to server id := component('sys.db', 'put', 'obj', o, 'class', ddb[2], 'db', ddb[1] ) - eDebug(5, "Form is saved:", id, o) + eDebug( 38, "Form is saved:", id, o ) window:objId := id window:origObj := o @@ -240,7 +240,7 @@ window := params:window endif - eDebug(10, "UI: Open view '"+params:name+"'") + eDebug( 28, "Open view '"+params:name+"'" ) // Define name and columns name := params:name @@ -254,13 +254,13 @@ // Apply data to widget pos := iif('SAVEPOSITION' $ params:widget, params:widget:savePosition(), NIL) - eDebug(5, "CURRENT ROW:", pos ) + eDebug( 38, "openView(): current row", pos ) params:widget:clear() - //eDebug(10, "OPENVIEW():", d:data) + //eDebug( 38, "openView():", d:data ) for i in d:data l := len(i) id := i[l] - //eDebug(14, "ADD ROW:", i, id) + //eDebug( 38, "openView(): add row", i, id ) asize(i,l-1) params:widget:addRow(i,id) if 'RESTOREPOSITION' $ params:widget @@ -271,11 +271,11 @@ // Autorefresh on timer if .not. empty(timeout) .and. valtype(window) == 'O' .and. 'TIMERS' $ window timeout := iif(valtype(timeout)!='N', val(timeout), timeout) - eDebug(5, "Set update timer for view '"+params:name+"' (", timeout, "second(s) )") + eDebug( 28, "Set update timer for view '"+params:name+"' (", timeout, "second(s) )" ) timer := UITimer(timeout, {|| openView(params:widget, params:name) } ) aadd(window:timers, timer) else - eDebug(5, "Timer is not set:", .not. empty(timeout), valtype(window) == 'O', 'TIMERS' $ window) + eDebug( 38, "Timer is not set:", .not. empty(timeout), valtype(window) == 'O', 'TIMERS' $ window ) endif return NIL @@ -296,13 +296,13 @@ endif // Get object from server - eDebug(5, "setFormObject id:", id) + eDebug( 28, "setFormObject(): id", id) ddb := form_splitClass( params:window:objClass ) if .not. empty(id) obj := component('sys.db', 'get', 'id', id, 'db', ddb[1] ) endif - eDebug(30, "UI setFormObject():", obj) + eDebug( 38, "UI setFormObject():", obj ) return params:window:setObj( obj ) @@ -310,7 +310,7 @@ static function c_dialogBoxConfirmClose( self, params ) local dlg - //eDebug(10, 'Confirmation dialog.') + //eDebug( 28, 'Confirmation dialog.' ) // Check params if assertParameters( params, { 'window:O', 'class:C' } ) return NIL @@ -331,11 +331,12 @@ /** Internal function for confirmation dialogbox */ static function confirmHandle( win, gId, class ) local dlg - //eDebug(15, "CONFIRM on close:", gId) + //eDebug( 28, "CONFIRM on close:", gId ) switch gId case "SAVE" if empty(saveForm(win, class)) dlg := win:dialogBox(i18n("Error"), i18n("Error saving document!")) + return endif win:close() case "NO" |