-
Notifications
You must be signed in to change notification settings - Fork 272
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
timestamp logs misleading #9
Comments
Unfortunately this is a c-library issue. I'm closing this since it's a c-library limitation and not a g3log bug. Feel free to do a pull request in case you come up with a great way of solving this. |
It's not the granularity that is the issue. It's the concatenation of the two numbers that creates inaccurate numbers. -------- Original message -------- From: Kjell Hedstrom notifications@github.com Date:05/14/2015 3:56 PM (GMT-05:00) To: KjellKod/g3log g3log@noreply.github.com Cc: BobIV bobflynn4@comcast.net Subject: Re: [g3log] timestamp logs misleading (#9) I'm closing this since it's a c-library limitation and not a g3log bug. Feel free to do a pull request in case you come up with a great way of solving this. — |
It can be easily changed to whatever formatting you like. g3log was made to support custom sinks. What formatting and how to output the logs can be done from a custom sink. Adding a custom sink is very easy. Please see the unit tests as well as the README for this repo: https://github.com/KjellKod/g3log If you want to achieve custom formatting using your own sink, then you should choose to have the log receiving function receive a Please see:
For how to use your own custom time formatting, please see examples of this, here
|
Your code is very well done and straight forward to customize, you did a great job. This particular topic was a slight problem that had a significant impact to some work I was doing. I felt the need to share the issue, but I think I am having trouble making my point clear. I would like to continue to try to explain this issue, but will refrain from continuing this thread unless you are interested. Your utilities are quite useful, and your efforts are appreciated. Thanks -------- Original message -------- From: Kjell Hedstrom notifications@github.com Date:05/14/2015 4:54 PM (GMT-05:00) To: KjellKod/g3log g3log@noreply.github.com Cc: BobIV bobflynn4@comcast.net Subject: Re: [g3log] timestamp logs misleading (#9) g3log was made to support custom sinks. What formatting and how to output the logs can be done from a custom sink. Adding a custom sink is very easy. Please see the unit tests as well as the README for this repo: https://github.com/KjellKod/g3log If you want to achieve custom formatting using your own sink, then you should choose to have the log receiving function receive a g2::LogMessageMover message instead of a std::string. This way you can do your own formatting on the log output. For how to use your own custom time formatting, please see src/g2filesinkhelper.hpp/cpp (more examples here) — |
Feedback is always welcome Feel free if you want to contact me off line. Hedstrom at kjellkod dot cc |
Fixed in #16 |
@BobIV true timestamp and not just a time counter is addressed in this pull request: #104 It gives the user/sink the option of using millisecond, microsecond or nanosecond as a true timestamp. The default will be microseconds. So far it is implemented for OSX and Linux. The pull request will only be merged when it is fixed for Windows also. For OSX and Windows the granularity is so far not as great as nanosecond. |
When the log details are generated in g2logmessage.cpp, it creates the following output:
2015/03/12 14:21:43.27000 INFO [processframework.cpp L: 138] "IPAddress read: 127.0.0.1"
Reading the timestamp and a high level view of the source code, I interpret the timestamp as:
year/month/day hour:min:sec.microsecond ....
From a single log entry it is not clear that the microsecond counter starts at the time g3log was initialized and counts up from there.
When using these log statements, the microsecond portion of the timestamp should be extracted from the rest of the timestamp for use in any sort of measurements.
I think it is best to separate these two components of the time stamp to highlight that they should not be interpreted as a fraction of the seconds from the system time seconds.
The text was updated successfully, but these errors were encountered: