10000 Add timestamp to log · Issue #390 · jaypipes/ghw · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add timestamp to log #390

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

Open
peter81git opened this issue Nov 11, 2024 · 4 comments
Open

Add timestamp to log #390

peter81git opened this issue Nov 11, 2024 · 4 comments

Comments

@peter81git
Copy link

For better log management it is required to have a timestamp for every line in the log file.
Is it possible to add it like [2024-11-11T18:52:27.937395+00:00] WARNING: failed to determine nodes: open /sys/devices/system/node: no such file or directory ?
Thank you.

@jaypipes
Copy link
Owner

@peter81git Hi! Hey, just FYI I'm at KubeCon NA 2024 all week and pretty busy... will try my best to get to this some time in the evening this week. Thanks for your patience!

@ffromani
Copy link
Collaborator
ffromani commented Nov 14, 2024

Hi! It is true that timestamps help, but ghw warnings are meant for exceptional circumstances rather than standard logging. I'd rather let callers pass a go-logr handle to use in ghw packages. This is a much larger effort though.

@ffromani
Copy link
Collaborator

logr reference: https://github.com/go-logr/logr

@ffromani
Copy link
Collaborator

While we debate if adding support for go-logr or not, you can use option.WithAlerter (see: https://github.com/jaypipes/ghw/blob/main/pkg/option/option.go#L179) to replace the default logger with one which adds timestamps without needing changes to ghw code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants
0