X-Git-Url: http://deadsoftware.ru/gitweb?a=blobdiff_plain;f=src%2Fengine%2Fe_log.pas;h=937730d5d4fd822260f19fbbe9d42861c8ef4192;hb=8213065ce7c035c3c2bb8d8b90ab423d42c0a5ac;hp=afc638cac7be82a9d7af6a0f1eb764811adf4eb8;hpb=223356cbae3197afc861efa6241c4ae91bd92885;p=d2df-sdl.git diff --git a/src/engine/e_log.pas b/src/engine/e_log.pas index afc638c..937730d 100644 --- a/src/engine/e_log.pas +++ b/src/engine/e_log.pas @@ -41,6 +41,7 @@ function DecodeIPV4 (ip: LongWord): string; procedure e_InitWritelnDriver (); procedure e_LogWritefln (const fmt: AnsiString; args: array of const; category: TRecordCategory=MSG_NOTIFY; writeTime: Boolean=true); +procedure e_LogWriteln (const s: AnsiString; category: TRecordCategory=MSG_NOTIFY; writeTime: Boolean=true); var @@ -68,54 +69,12 @@ procedure e_WriteLog (TextLine: String; RecordCategory: TRecordCategory; WriteTi begin e_LogWritefln('%s', [TextLine], RecordCategory, WriteTime); end; -(* -var - LogFile: TextFile; - Prefix: ShortString = ''; - OutStr: String; -begin - if driverInited and (length(TextLine) > 0) then - begin - case RecordCategory of - MSG_FATALERROR: write('FATAL: '); - MSG_WARNING: write('WARNING: '); - end; - writeln(TextLine); - end; - if FileName = '' then Exit; - Assign(LogFile, FileName); - try - if FileExists(FileName) then - Append(LogFile) - else - Rewrite(LogFile); - try - if FirstRecord then - begin - Writeln(LogFile, '--- Log started at '+TimeToStr(Time)+' ---'); - FirstRecord := False; - end; - case RecordCategory of - MSG_FATALERROR: Prefix := '!!!'; - MSG_WARNING: Prefix := '! '; - MSG_NOTIFY: Prefix := '***'; - end; - if WriteTime then - OutStr := '['+TimeToStr(Time)+'] '+Prefix+' '+TextLine - else - OutStr := Prefix+' '+TextLine; - Writeln(LogFile, OutStr); - if e_WriteToStdOut then - Writeln(OutStr); - finally - Close(LogFile); - end; - except // sorry - end; +procedure e_LogWriteln (const s: AnsiString; category: TRecordCategory=MSG_NOTIFY; writeTime: Boolean=true); +begin + e_LogWritefln('%s', [s], category, writeTime); end; -*) // returns formatted string if `writerCB` is `nil`, empty string otherwise