2009-01-16 00:13 UTC+0100 Francesco Saverio Giudice (info/at/fsgiudice.com)

* harbour/source/rdd/usrrdd/rdds/logrdd.prg
    * Added new functions
    ; NOTE:
         hb_LogRddMsgLogBlock( [<bMsgLogBlock>] ) -> <bOldMsgLogBlock>
           bMsgLogBlock codeblock permits to user to alter message to log
           into standard log file.
           Codeblock receives follow parameters:
           cTag, cRDDName, cCmd, nWA, cMsg
         hb_LogRddUserLogBlock( [<bUserLogBlock>] ) -> <bOldUserLogBlock>
           bUserLogBlock codeblock redirect all log to user that can log
           everywhere. Parameters send to bUserLogBlock are same of
           bMsgLogBlock.

  * harbour/source/rdd/usrrdd/example/exlog.prg
    * Changed with new functions

  * harbour/make_b32.bat
    * removed comment on first line
This commit is contained in:
Francesco Saverio Giudice
2009-01-15 23:15:18 +00:00
parent 1ab68f54c7
commit 92757facfd
4 changed files with 142 additions and 19 deletions

View File

@@ -8,6 +8,47 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2009-01-16 00:13 UTC+0100 Francesco Saverio Giudice (info/at/fsgiudice.com)
* harbour/source/rdd/usrrdd/rdds/logrdd.prg
* Added new functions
; NOTE:
hb_LogRddMsgLogBlock( [<bMsgLogBlock>] ) -> <bOldMsgLogBlock>
bMsgLogBlock codeblock permits to user to alter message to log
into standard log file.
Codeblock receives follow parameters:
cTag, cRDDName, cCmd, nWA, cMsg
hb_LogRddUserLogBlock( [<bUserLogBlock>] ) -> <bOldUserLogBlock>
bUserLogBlock codeblock redirect all log to user that can log
everywhere. Parameters send to bUserLogBlock are same of
bMsgLogBlock.
* harbour/source/rdd/usrrdd/example/exlog.prg
* Changed with new functions
* harbour/make_b32.bat
* removed comment on first line
2009-01-15 23:08 UTC+0100 Francesco Saverio Giudice (info/at/fsgiudice.com)
* harbour/common.mak
* harbour/config/global.cf
* harbour/harbour-wce-spec
* harbour/harbour-win-spec
* harbour/harbour.spec
* harbour/make_b32.bat
* harbour/make_b32.mak
* harbour/make_gcc.mak
* harbour/make_vc.mak
* Added hbuddall library to standard make files
; NOTE: hbuddall contains all USR RDDS files in
harbour/source/rdd/usrrdd/rdds/*
Viktor pls check me.
* harbour/source/rdd/usrrdd/rdds/arrayrdd.prg
* harbour/source/rdd/usrrdd/rdds/fcomma.prg
* harbour/source/rdd/usrrdd/rdds/hscdx.prg
* harbour/source/rdd/usrrdd/rdds/logrdd.prg
* fixed assigned but unused variable
2009-01-15 21:27 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbct/ctwin.c
* added small hack for scrolling console output when client area
@@ -32,7 +73,7 @@
* harbour/contrib/hbct/ctextern.ch
! removed HB_GT_CTW and HB_GT_CTW_DEFAULT added by mistake
It caused GPF at HVM startup because CTW was register as
default GT driver
default GT driver
* harbour/contrib/hbbmcdx/bmdbfcdx.c
! added missing hbstack.h

View File

@@ -1,4 +1,4 @@
rem @echo off
@echo off
rem
rem $Id$
rem

View File

@@ -26,6 +26,11 @@ PROCEDURE Main()
// Activate Logging, it can be stopped/started at any moment
hb_LogRddActive( .T. )
// Uncomment next command to change logged string to standard LOGRDD file
// hb_LogRddMsgLogBlock( {|cTag, cRDDName, cCmd, nWA, cMsg| DToS( Date() ) + " / " + Time() + " " + cTag + ": " + PadR( cRDDName + "_" + cCmd, 20 ) + " - " + cMsg } )
// Uncomment next command to change standard destination logged string
// hb_LogRddUserLogBlock( {|cTag, cRDDName, cCmd, nWA, cMsg| hb_toOutDebug( DToS( Date() ) + " : " + Time() + " " + cTag + ": " + PadR( cRDDName + "_" + cCmd, 20 ) + " - " + cMsg + "\n\r" ) } )
// Start program logic
// Open a table with logging (default RDD is LOGRDD)

View File

@@ -68,11 +68,13 @@
#include "fileio.ch"
#include "dbinfo.ch"
#define ARRAY_FILENAME 1
#define ARRAY_FHANDLE 2
#define ARRAY_TAG 3
#define ARRAY_ACTIVE 4
#define ARRAY_RDDNAME 5
#define ARRAY_FILENAME 1
#define ARRAY_FHANDLE 2
#define ARRAY_TAG 3
#define ARRAY_ACTIVE 4
#define ARRAY_RDDNAME 5
#define ARRAY_MSGLOGBLOCK 6
#define ARRAY_USERLOGBLOCK 7
ANNOUNCE LOGRDD
REQUEST HB_LOGRDDINHERIT /* To be defined at user level */
@@ -93,8 +95,8 @@ STATIC FUNCTION LOGRDD_INIT( nRDD )
/* Log File will be open later so user can change parameters */
/* Store data in RDD cargo */
/* cFileName, nHandle, cTag, lActive, cRDDName */
USRRDD_RDDDATA( nRDD, { cFileName, NIL, cTag, lActive, cRDDName } )
/* cFileName, nHandle, cTag, lActive, cRDDName, bMsgLogBlock, bUserLogBlock */
USRRDD_RDDDATA( nRDD, { cFileName, NIL, cTag, lActive, cRDDName, NIL, NIL } )
RETURN SUCCESS
@@ -286,6 +288,52 @@ FUNCTION hb_LogRddActive( lActive )
ENDIF
RETURN lOldActive
FUNCTION hb_LogRddMsgLogBlock( bMsgLogBlock )
LOCAL nRDD, aRDDList
LOCAL aRDDData
LOCAL bOldMsgLogBlock
aRDDList := RDDLIST( RDT_FULL )
nRDD := AScan( aRDDList, "LOGRDD" )
IF nRDD > 0
nRDD -- // HACK: Possibly an error of nRDD value in UR_INIT() ? - TODO
aRDDData := USRRDD_RDDDATA( nRDD )
bOldMsgLogBlock := aRDDData[ ARRAY_MSGLOGBLOCK ]
IF HB_ISBLOCK( bMsgLogBlock )
aRDDData[ ARRAY_MSGLOGBLOCK ] := bMsgLogBlock
ENDIF
ENDIF
RETURN bOldMsgLogBlock
FUNCTION hb_LogRddUserLogBlock( bUserLogBlock )
LOCAL nRDD, aRDDList
LOCAL aRDDData
LOCAL bOldUserLogBlock
aRDDList := RDDLIST( RDT_FULL )
nRDD := AScan( aRDDList, "LOGRDD" )
IF nRDD > 0
nRDD -- // HACK: Possibly an error of nRDD value in UR_INIT() ? - TODO
aRDDData := USRRDD_RDDDATA( nRDD )
bOldUserLogBlock := aRDDData[ ARRAY_MSGLOGBLOCK ]
IF HB_ISBLOCK( bUserLogBlock )
aRDDData[ ARRAY_USERLOGBLOCK ] := bUserLogBlock
ENDIF
ENDIF
RETURN bOldUserLogBlock
STATIC PROCEDURE OpenLogFile( nWA )
LOCAL aRDDData := USRRDD_RDDDATA( USRRDD_ID( nWA ) )
LOCAL cFileName := aRDDData[ ARRAY_FILENAME ]
@@ -321,20 +369,44 @@ STATIC PROCEDURE OpenLogFile( nWA )
STATIC PROCEDURE ToLog( cCmd, nWA, cMsg )
LOCAL aRDDData := USRRDD_RDDDATA( USRRDD_ID( nWA ) )
LOCAL nHandle := aRDDData[ ARRAY_FHANDLE ]
LOCAL cTag := aRDDData[ ARRAY_TAG ]
LOCAL lActive := aRDDData[ ARRAY_ACTIVE ]
LOCAL cRDDName := aRDDData[ ARRAY_RDDNAME ]
LOCAL lActive := aRDDData[ ARRAY_ACTIVE ]
LOCAL nHandle, cTag, cRDDName, bMsgLogBlock, bUserLogBlock, cLog
//TraceLog( "nHandle " + cStr( nHandle ) + " cUser " + cUser )
// Check if logging system is active
IF lActive
IF nHandle == NIL
OpenLogFile( nWA )
ENDIF
cTag := aRDDData[ ARRAY_TAG ]
cRDDName := aRDDData[ ARRAY_RDDNAME ]
bUserLogBlock := aRDDData[ ARRAY_USERLOGBLOCK ]
// If not defined a User codeblock
IF !HB_ISBLOCK( bUserLogBlock )
nHandle := aRDDData[ ARRAY_FHANDLE ]
// If log file is not already open I open now
IF nHandle == NIL
OpenLogFile( nWA )
ENDIF
IF nHandle != NIL
bMsgLogBlock := aRDDData[ ARRAY_MSGLOGBLOCK ]
// If defined a codeblock I send to user infos and he have to return a formatted string
IF HB_ISBLOCK( bMsgLogBlock )
cLog := Eval( bMsgLogBlock, cTag, cRDDName, cCmd, nWA, cMsg )
ELSE
cLog := DToS( Date() ) + " " + Time() + " " + cTag + ": " + PadR( cRDDName + "_" + cCmd, 20 ) + " - " + cMsg
ENDIF
FWrite( nHandle, cLog + hb_OSNewLine() )
ENDIF
ELSE
// Otherwise I send all to user that is responsible to log
Eval( bUserLogBlock, cTag, cRDDName, cCmd, nWA, cMsg )
IF nHandle != NIL
FWrite( nHandle, DToS( Date() ) + " " + Time() + " " + cTag + ": " + PadR( cRDDName + "_" + cCmd, 20 ) + " - " + cMsg + hb_OSNewLine() )
ENDIF
ENDIF
@@ -398,6 +470,11 @@ PROCEDURE Main()
// Activate Logging, it can be stopped/started at any moment
hb_LogRddActive( .T. )
// Uncomment next command to change logged string to standard LOGRDD file
// hb_LogRddMsgLogBlock( {|cTag, cRDDName, cCmd, nWA, cMsg| DToS( Date() ) + " / " + Time() + " " + cTag + ": " + PadR( cRDDName + "_" + cCmd, 20 ) + " - " + cMsg } )
// Uncomment next command to change standard destination logged string
// hb_LogRddUserLogBlock( {|cTag, cRDDName, cCmd, nWA, cMsg| hb_toOutDebug( DToS( Date() ) + " : " + Time() + " " + cTag + ": " + PadR( cRDDName + "_" + cCmd, 20 ) + " - " + cMsg + "\n\r" ) } )
// Start program logic
// Open a table with logging (default RDD is LOGRDD)