-
Notifications
You must be signed in to change notification settings - Fork 38.7k
[logging] log system time and mock time #10383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
An alternative suggestion would be to log changes to the mock time, instead of prepending it to every line, which causes vary long lines. |
|
This looks reasonable to me, utACK. This will fix the issues that @laanwj I'd personally prefer to have the extra timestamp on each line when using mocktime -- one use case I have is for my simulation environment, where mocktime is set on every message (tx, block, etc) that is delivered to bitcoind. Adding an extra line for each change in mocktime would add substantial clutter, and also make reading/parsing the actual debug output more difficult (the mocktime is usually more interesting to me than the system time). |
|
OK as this is only used for testing (and only a subset of the tests, as that) I'm fine with adding it to every line. |
kallewoof
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK 761392d
761392d [logging] log system time and mock time (John Newbery) Tree-SHA512: 0a4b3ad74bcac201be490fe12e4b45adeabc39030ac46f40e1aeb2a20b2f3963e4468e65798d8aaeca1818759cab55ff2b2aa214500aa11571492c3301dd31c1
761392d [logging] log system time and mock time (John Newbery) Tree-SHA512: 0a4b3ad74bcac201be490fe12e4b45adeabc39030ac46f40e1aeb2a20b2f3963e4468e65798d8aaeca1818759cab55ff2b2aa214500aa11571492c3301dd31c1
f3f3d6c util: fix compilation with mingw-w64 7.0.0 (Fuzzbawls) f24da7d util: Avoid potential uninitialized read in FormatISO8601DateTime (Fuzzbawls) 120a12a util: Add type safe GetTime (Fuzzbawls) be48766 Fix for utiltime to compile with msvc. (Aaron Clauson) 2833406 Avoid std::locale/imbue in DateTimeStrFormat (Pieter Wuille) 3331c25 Format automatic wallet backup file names in ISO 8601 basic format (Fuzzbawls) c32a208 Format timestamps using ISO 8601 formatting (e.g. "2018-02-28T12:34:56Z") (practicalswift) f8bd173 [logging] log system time and mock time (John Newbery) Pull request description: This is a backport of a collection of upstream PRs to bring our time utility more up to date. The following upstream PRs are included: - bitcoin#10383 - bitcoin#12567 - bitcoin#12973 - bitcoin#13031 - bitcoin#16046 - bitcoin#18162 - bitcoin#18358 The two user-facing notable changes here have been documented in the release notes template. I've also connected the functionality that `-logtimemicros` was supposed to provide. ACKs for top commit: furszy: code review ACK f3f3d6c random-zebra: utACK f3f3d6c after rebase, and merging... Tree-SHA512: 64f9cc1f7fc65c192f3b3ab869c057a81e007cf0fae82ecd23993c6b51830e4bc80656c699ba40bb8e019115a24d1ea88a618be0c0d7112749d9ce125d62ce44
Currently, if mocktime is set, the logs will be timestamped with the mocktime instead of the system time. It's often useful to have the system time in the logs (for example, when running an integration test, it's useful to know what bitcoind was doing at system time so you can see how it's interacting with the test framework or other bitcoind nodes).
This PR timestamps the log with the actual system time, and also prints out the mocktime if mocktime is being used.
@sdaftuar