Skip to content
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

Introduce more context to logging #256

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ross-spencer
Copy link
Collaborator

A new log formatter is introduced that adds program contex to the log output, e.g. source file, and line of code where a log call is made. Additional program context can be added consistently. Datetime is formatted in ISO format and an option is provided to use UTC or local timezones.

Log formatting now looks more like as follows:

r0ss@exponential-decay:~/git/richardlehane/siegfried/cmd/roy$ ./roy harvest
2024-08-03 13:26:06 :: roy :: roy.go:658: roy: errors saving reports to disk [open : no such file or directory]

r0ss@exponential-decay:~/git/richardlehane/siegfried/cmd/roy$ ./roy build
2024-08-03 13:32:20 :: roy :: roy.go:658: pronom: error loading containers; got open : no such file or directory
Unless you have set `-nocontainer` you need to download a container signature file

r0ss@exponential-decay:~/git/richardlehane/siegfried/cmd/sf$ ./sf
2024-08-03 13:37:10 :: sf :: sf.go:477: [FATAL] expecting one or more file or directory arguments (or '-' to scan stdin)

versus;

r0ss@exponential-decay:~/git/richardlehane/siegfried/cmd/sf$ ./sf
2024/08/03 15:49:38 [FATAL] expecting one or more file or directory arguments (or '-' to scan stdin)

r0ss@exponential-decay:~/git/richardlehane/siegfried/cmd/roy$ ./roy build
2024/08/03 15:49:29 pronom: error loading containers; got open : no such file or directory
Unless you have set `-nocontainer` you need to download a container signature file

In future commits, log messages can be modified to remove manually entered references to "roy" or "sf".

One question might be to set datetime to UTC by default or not. I've started using the former in most codebases. Folks may still prefer local.

A new log formatter is introduced that adds program contex to the
log output, e.g. source file, and line of code where a log call
is made. Additional program context can be added consistently.
Datetime is formatted in ISO format and an option is provided to
use UTC or local timezones.
@richardlehane
Copy link
Owner

thanks Ross I'll take a look!

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

Successfully merging this pull request may close these issues.

2 participants