Create log timestamps in UTC to avoid local-time races
Use getTime().utc in both message constructors, document the timezone change, and cover concurrent construction and structured formatting. Restore ordinary logging calls in the parallel writer fixture. Validation: 32 unit tests and 29 regression tests pass. Timestamp sanitizer checks pass under UTC and non-UTC timezones. The full suite retains the known allocator reports in factory-state and allocator.
This commit is contained in:
1 parent
011780e6ab
commit
46245b3f1e
6 files changed
+48
-17
No files matched your search
@@ -133,6 +133,11 @@ the same manner to loggers in this library.
|
||||
|
||||
### LogFormatter
|
||||
|
||||
Messages created by the library carry UTC timestamps in `LogMessage.ts`, which
|
||||
remains a `DateTime`. This changes the previous local-time behavior. Structured
|
||||
JSON output represents these timestamps with a `Z` suffix. Explicit timestamps
|
||||
in caller-constructed `LogMessage` values are preserved.
|
||||
|
||||
Console, file, and std/logging appenders accept a *LogFormatter*. Noncapturing
|
||||
functions such as *formatSimpleTextLog* and *formatJsonStructuredLog* are
|
||||
converted automatically:
|
||||
@@ -342,9 +347,8 @@ not refresh configuration; see [Avoiding Expensive Log Preparation](#avoiding-ex
|
||||
|
||||
> [!NOTE]
|
||||
> Thread-safety work is still in progress. Custom state and captured
|
||||
> formatters must follow the ownership rules above. Concurrent local-time
|
||||
> timestamp construction still has a known failure.
|
||||
> Nim 2.2.10 also produces sanitizer reports in its default allocator
|
||||
> formatters must follow the ownership rules above.
|
||||
> Nim 2.2.10 produces sanitizer reports in its default allocator
|
||||
> during some cross-thread allocation patterns. See
|
||||
> [the regression tests](tests/README.md) for the remaining work.
|
||||
|
||||
|
||||
Reference in new issue
Block a user