84 lines
2.1 KiB
Plaintext
84 lines
2.1 KiB
Plaintext
#DEFINE CRLF CHR(13) + CHR(10)
|
|
|
|
DEFINE CLASS log_mesaje as Relation
|
|
|
|
cLogFile = ""
|
|
|
|
&& ------------------------------INCEPUT: Init ------------------------------
|
|
*!* Procedura: Init
|
|
*!* Parametri:
|
|
*!* Data/Ora generarii: 20/02/2004 12:41:53
|
|
*!* Autor: MARIUS.MUTU
|
|
PROCEDURE Init
|
|
LPARAMETERS tcLogFile, tlAdditive
|
|
|
|
LOCAL lcLogFile, llAdditive
|
|
LOCAL loEx as Exception
|
|
lcLogFile = IIF(TYPE('tcLogFile') = 'C', m.tcLogFile, ADDBS(SHORTPATH(JUSTPATH(SYS(16,0)))) + "log.txt")
|
|
this.cLogFile = m.lcLogFile
|
|
|
|
SET console off
|
|
SET TALK OFF
|
|
|
|
|
|
IF PARAMETERS() < 2
|
|
llAdditive = .T.
|
|
ELSE
|
|
llAdditive = tlAdditive
|
|
ENDIF
|
|
|
|
IF FILE(lcLogFile)
|
|
lcText = TTOC(DATETIME()) + " " + SYS(0) + IIF(TYPE('GCS')='C'," " + GCS,"") + CRLF
|
|
|
|
TRY
|
|
STRTOFILE(lcText, lcLogFile, llAdditive)
|
|
CATCH TO loEx
|
|
* nu pot sa scriu in log
|
|
ENDTRY
|
|
ENDIF && file(lcLogFile)
|
|
|
|
ENDPROC
|
|
&& ------------------------------SFARSIT: Init ------------------------------
|
|
|
|
&& ------------------------------INCEPUT: Log ------------------------------
|
|
*!* Procedura: Log
|
|
*!* Parametri: tcText
|
|
*!* Data/Ora generarii: 20/02/2004 12:48:57
|
|
*!* Autor: MARIUS.MUTU
|
|
PROCEDURE Log
|
|
LPARAMETERS tcText, tcProgram
|
|
|
|
LOCAL lcText, lcLogFile
|
|
LOCAL loEx as Exception
|
|
lcLogFile = this.cLogFile
|
|
IF !FILE(lcLogFile)
|
|
RETURN
|
|
ENDIF
|
|
|
|
SET console off
|
|
SET TALK OFF
|
|
|
|
lcText = IIF(EMPTY(tcText),"",ALLTRIM(tcText))
|
|
lcProgram = IIF(EMPTY(tcProgram),"",ALLTRIM(tcProgram))
|
|
lcSpatiu = SPACE(10)
|
|
lcSeparator = " *** "
|
|
|
|
IF FILE(lcLogFile)
|
|
lcText = TTOC(DATETIME()) + " " + SYS(0) + IIF(TYPE('GCS')='C'," " + GCS,"") + m.lcSeparator + ;
|
|
IIF(!EMPTY(lcProgram),lcProgram,"") + IIF(!EMPTY(lcText),lcSpatiu+lcText,"") + CRLF
|
|
|
|
TRY
|
|
STRTOFILE(lcText, lcLogFile, .T.)
|
|
CATCH TO loEx
|
|
* nu pot sa scriu in log
|
|
ENDTRY
|
|
ENDIF && file(lcLogFile)
|
|
|
|
ENDPROC
|
|
&& ------------------------------SFARSIT: Log ------------------------------
|
|
Procedure WriteLog
|
|
Lparameters tcText, tcProgram
|
|
This.Log(m.tcText, m.tcProgram)
|
|
ENDPROC && WriteLog
|
|
|
|
ENDDEFINE && log_mesaje |