Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | {1866} all logged timestamps are now in UTC |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
4323913fcf8a8a9f4b44147bfedb4d0b |
User & Date: | ab 2015-09-10 06:55:12 |
2015-09-10
| ||
11:50 | {1871} fix Linux compilation issue introduced by [4323913fcf8a] check-in: 0408f7608e user: ab tags: trunk | |
2015-09-10
| ||
06:58 | {1867} fixed Delphi 5 compilation check-in: f929978fe5 user: ab tags: trunk | |
06:55 | {1866} all logged timestamps are now in UTC check-in: 4323913fcf user: ab tags: trunk | |
2015-09-09
| ||
14:43 | {1865} fixed long standing issue in JsonToObject() which forbidded to unserialize a variant published field from a JSON array or document check-in: a6c9577409 user: ab tags: trunk | |
Changes to SynCommons.pas.
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
.....
39309
39310
39311
39312
39313
39314
39315
39316
39317
39318
39319
39320
39321
39322
39323
39324
39325
39326
39327
39328
39329
39330
39331
39332
39333
39334
39335
39336
39337
39338
|
/// append CR+LF (#13#10) chars and #9 indentation // - indentation depth is defined by fHumanReadableLevel protected field procedure AddCRAndIndent; /// write the same character multiple times procedure AddChars(aChar: AnsiChar; aCount: integer); /// append an Integer Value as a 2 digits String with comma procedure Add2(Value: integer); /// append the current date and time, in a log-friendly format // - e.g. append '20110325 19241502 ' // - this method is very fast, and avoid most calculation or API calls procedure AddCurrentLogTime; /// append a time period, specified in micro seconds procedure AddMicroSec(MS: cardinal); /// append an Integer Value as a 4 digits String with comma procedure Add4(Value: integer); ................................................................................ pCardinal(B+1)^ := $30303030 else // '0000,' if overflow YearToPChar(Value,B+1); inc(B,5); B^ := ','; end; var // can be safely made global since timing is multi-thread safe GlobalTime: TSystemTime; GlobalClock: cardinal; procedure TTextWriter.AddCurrentLogTime; var Ticks: cardinal; begin if BEnd-B<=17 then FlushToStream; inc(B); Ticks := GetTickCount; // this call is very fast (just one integer mul) if GlobalClock<>Ticks then begin // typically in range of 10-16 ms GlobalClock := Ticks; GetLocalTime(GlobalTime); // avoid slower API call end; YearToPChar({$ifdef MSWINDOWS}GlobalTime.wYear{$else}GlobalTime.Year{$endif},B); with GlobalTime do begin PWord(B+4)^ := TwoDigitLookupW[{$ifdef MSWINDOWS}wMonth{$else}Month{$endif}]; PWord(B+6)^ := TwoDigitLookupW[{$ifdef MSWINDOWS}wDay{$else}Day{$endif}]; B[8] := ' '; PWord(B+9)^ := TwoDigitLookupW[{$ifdef MSWINDOWS}wHour{$else}Hour{$endif}]; PWord(B+11)^ := TwoDigitLookupW[{$ifdef MSWINDOWS}wMinute{$else}Minute{$endif}]; PWord(B+13)^ := TwoDigitLookupW[{$ifdef MSWINDOWS}wSecond{$else}Second{$endif}]; PWord(B+15)^ := TwoDigitLookupW[{$ifdef MSWINDOWS}wMilliseconds shr 4{$else}Millisecond shr 4{$endif}]; // range 0..62 = 16 ms |
|
|
|
|
|
|
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
.....
39309
39310
39311
39312
39313
39314
39315
39316
39317
39318
39319
39320
39321
39322
39323
39324
39325
39326
39327
39328
39329
39330
39331
39332
39333
39334
39335
39336
39337
39338
|
/// append CR+LF (#13#10) chars and #9 indentation // - indentation depth is defined by fHumanReadableLevel protected field procedure AddCRAndIndent; /// write the same character multiple times procedure AddChars(aChar: AnsiChar; aCount: integer); /// append an Integer Value as a 2 digits String with comma procedure Add2(Value: integer); /// append the current UTC date and time, in a log-friendly format // - e.g. append '20110325 19241502 ' // - this method is very fast, and avoid most calculation or API calls procedure AddCurrentLogTime; /// append a time period, specified in micro seconds procedure AddMicroSec(MS: cardinal); /// append an Integer Value as a 4 digits String with comma procedure Add4(Value: integer); ................................................................................ pCardinal(B+1)^ := $30303030 else // '0000,' if overflow YearToPChar(Value,B+1); inc(B,5); B^ := ','; end; var // can be safely made global since timing is multi-thread safe GlobalTimeUTC: TSystemTime; GlobalClock: cardinal; procedure TTextWriter.AddCurrentLogTime; var Ticks: cardinal; begin if BEnd-B<=17 then FlushToStream; inc(B); Ticks := GetTickCount; // this call is very fast (just one integer mul) if GlobalClock<>Ticks then begin // typically in range of 10-16 ms GlobalClock := Ticks; GetSystemTime(GlobalTimeUTC); // avoid slower API call end; YearToPChar({$ifdef MSWINDOWS}GlobalTimeUTC.wYear{$else}GlobalTimeUTC.Year{$endif},B); with GlobalTimeUTC do begin PWord(B+4)^ := TwoDigitLookupW[{$ifdef MSWINDOWS}wMonth{$else}Month{$endif}]; PWord(B+6)^ := TwoDigitLookupW[{$ifdef MSWINDOWS}wDay{$else}Day{$endif}]; B[8] := ' '; PWord(B+9)^ := TwoDigitLookupW[{$ifdef MSWINDOWS}wHour{$else}Hour{$endif}]; PWord(B+11)^ := TwoDigitLookupW[{$ifdef MSWINDOWS}wMinute{$else}Minute{$endif}]; PWord(B+13)^ := TwoDigitLookupW[{$ifdef MSWINDOWS}wSecond{$else}Second{$endif}]; PWord(B+15)^ := TwoDigitLookupW[{$ifdef MSWINDOWS}wMilliseconds shr 4{$else}Millisecond shr 4{$endif}]; // range 0..62 = 16 ms |
Changes to SynLog.pas.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 .... 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 .... 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 |
Version 1.18 - first public release, extracted from SynCommons.pas unit - BREAKING CHANGE: PWinAnsiChar type for constant text format parameters has been changed into a RawUTF8, to please all supported platforms and compilers - WARNING: any user of the framework in heavy-loaded multi-threaded application should UPGRADE to at least revision 1.18.1351, fixing a long-standing bug - Delphi XE4/XE5/XE6/XE7/XE8/10Seattle compatibility (Windows target platforms) - unit fixed and tested with Delphi XE2 (and up) 64-bit compiler under Windows - compatibility with (Cross)Kylix 3 and FPC 3.1 under Linux (and Darwin) - Exception logging and Stack trace do work now on Linux with Kylix/CrossKylix - added TSynLogFile.Freq read-only property - added DefaultSynLogExceptionToStr() function and TSynLogExceptionToStrCustom variable, and ESynException.CustomLog() method to customize how raised ................................................................................ procedure TSynLog.LogFileHeader; var WithinEvents: boolean; {$ifdef MSWINDOWS} Env: PAnsiChar; P: PUTF8Char; L: Integer; {$endif} procedure NewLine; begin if WithinEvents then begin fWriter.AddEndOfLine(sllNewRun); LogCurrentTime; fWriter.AddShort(LOG_LEVEL_TEXT[sllNewRun]); end else fWriter.Add(#13); end; begin WithinEvents := fWriter.WrittenBytes>0; // array of const is buggy under Delphi 5 :( -> use fWriter.Add*() below if WithinEvents then begin LogCurrentTime; fWriter.AddShort(LOG_LEVEL_TEXT[sllNewRun]); fWriter.AddChars('=',50); ................................................................................ end; FreeEnvironmentStringsA(Env); CancelLastChar(#9); {$endif} NewLine; AddClassName(self.ClassType); AddShort(' '+SYNOPSE_FRAMEWORK_FULLVERSION+' '); AddDateTime(Now); if WithinEvents then AddEndOfLine(sllNone) else Add(#13,#13); FlushToStream; EchoReset; // header is not to be sent to console end; Include(fInternalFlags,logHeaderWritten); |
> > | | | | | | | | | > | |
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 .... 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 .... 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 |
Version 1.18 - first public release, extracted from SynCommons.pas unit - BREAKING CHANGE: PWinAnsiChar type for constant text format parameters has been changed into a RawUTF8, to please all supported platforms and compilers - WARNING: any user of the framework in heavy-loaded multi-threaded application should UPGRADE to at least revision 1.18.1351, fixing a long-standing bug - all logged timestamps are now in UTC - Delphi XE4/XE5/XE6/XE7/XE8/10Seattle compatibility (Windows target platforms) - unit fixed and tested with Delphi XE2 (and up) 64-bit compiler under Windows - compatibility with (Cross)Kylix 3 and FPC 3.1 under Linux (and Darwin) - Exception logging and Stack trace do work now on Linux with Kylix/CrossKylix - added TSynLogFile.Freq read-only property - added DefaultSynLogExceptionToStr() function and TSynLogExceptionToStrCustom variable, and ESynException.CustomLog() method to customize how raised ................................................................................ procedure TSynLog.LogFileHeader; var WithinEvents: boolean; {$ifdef MSWINDOWS} Env: PAnsiChar; P: PUTF8Char; L: Integer; {$endif} procedure NewLine; begin if WithinEvents then begin fWriter.AddEndOfLine(sllNewRun); LogCurrentTime; fWriter.AddShort(LOG_LEVEL_TEXT[sllNewRun]); end else fWriter.Add(#13); end; begin WithinEvents := fWriter.WrittenBytes>0; // array of const is buggy under Delphi 5 :( -> use fWriter.Add*() below if WithinEvents then begin LogCurrentTime; fWriter.AddShort(LOG_LEVEL_TEXT[sllNewRun]); fWriter.AddChars('=',50); ................................................................................ end; FreeEnvironmentStringsA(Env); CancelLastChar(#9); {$endif} NewLine; AddClassName(self.ClassType); AddShort(' '+SYNOPSE_FRAMEWORK_FULLVERSION+' '); AddDateTime(NowUTC); if WithinEvents then AddEndOfLine(sllNone) else Add(#13,#13); FlushToStream; EchoReset; // header is not to be sent to console end; Include(fInternalFlags,logHeaderWritten); |
Changes to SynopseCommit.inc.
1 |
'1.18.1865'
|
| |
1 |
'1.18.1866'
|