-
Notifications
You must be signed in to change notification settings - Fork 147
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
Allow easy support for different time formats #35
Comments
I think this is worth considering. I have also wanted to change the time format. In my case I want to add fractional seconds for more precision. Also, we recognize that writing custom formatters is more burdensome that it should be and would like to improve that in the future. |
You could write a simple handler to add this for you, but it's going to be a separate key instead of 't':
|
That works, but the only drawback is it is redundant data. I try and log everything, or rather as much as possible. Over time, this translates to more network as well as disk bandwidth. |
Yep, I agree. It's a temporary work around. We'd like to make formatters more flexible to tweaking, like Chris said in a future release. |
I would like this too. I could see a range of ways to do this:
Is there a better way? If any of the above appeal I'd be happy to submit a pull request. |
To date I've just modified the timeFormat constant in my internal fork of log15. If we just want to resolve the issue of customizing the time format produced by @grahamking I'll gladly review the code if you want to submit a pull request along those lines. |
Can now configure the following in LogfmtFormat using functional options style: - time format - float format - float precision Discussion in inconshreveable#35.
Hello, Does it exist another way? |
Replace +0000 suffix for UTC timestamps in log files with .nnnZ, gaining millisecond precision. Terminal format is unaffected. Unfortunately, changing the time format currently requires modifying the code. See inconshreveable#35 for discussion.
This is a very basic approach, but it is pretty non-invasive, doesn't have a runtime overhead, and provides a fix until inconshreveable#35 is resolved in a more comprehensive way.
This is a very basic approach, but it is pretty non-invasive, doesn't have a runtime overhead, and provides a fix until inconshreveable#35 is resolved in a more comprehensive way.
This is a very basic approach, but it is pretty non-invasive, doesn't have a runtime overhead, and provides a fix until inconshreveable#35 is resolved in a more comprehensive way.
I'd like to use epoch time in my log files since I happen to be using epoch time within the server. Is it possible to have this natively supported as opposed to having to make a specific formatter for this? It seems useful in the sense of being able to reuse the existing formatter code versus adding a new formatter to modify only one field.
The text was updated successfully, but these errors were encountered: