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

request: add 'success' log level #88

Closed
KyleTryon opened this issue Nov 12, 2023 · 5 comments
Closed

request: add 'success' log level #88

KyleTryon opened this issue Nov 12, 2023 · 5 comments

Comments

@KyleTryon
Copy link

Example

log.Success("Complete!")

Where the output in this case would be green and have a prefix similar to SUCC.

This would be at the same level as "Info" but offer an alternative style

@damongolding
Copy link

I would like this too!

@plastikfan
Copy link

plastikfan commented Jan 25, 2024

I have just discovered the glorious charm universe and the logging aspect has drawn my attension as I'm looking to integrate charm's log into some of my own projects. I noticed this issue, which initially seemed like a good idea, but after I did a little research, I came to conclusion that it is not and the reason is standards. Logging has a long history and has evolved from standards, in particluar, the syslog standard and also see RFC-5424. Actually I found a very good blog post: logging levels explained that may interest you. If you need a custom new non standard log level (even if its just a synonym for INFO), then it would be unadvisbable to implement in charm, it would be better for you to do this in a fork and doing so in charm would encourage third parties to become dependent on non standard functionality.

If any change is made, then the TRACE level could be added as that is in the standard, but I get it, this won't help your use case.

@eko234
Copy link

eko234 commented Mar 11, 2024

Hello, I have a similar usecase, but I think a workaround maybe to allow the kv pairs to overwrite the level maybe? it could be opt in with a new option from the config, I will work it out some other way but just wanted to let this idea.

@aymanbagabas
Copy link
Member

Hi everyone! With the changes introduced in #95, you can now define your custom level and wrap the logger with your type to achieve the same behavior. Take a look at this example
Keep in mind that these changes are still in main and will be part of the new release v0.4.0 soon 🙂

@aymanbagabas
Copy link
Member

Log v0.4.0 is out now! closing...

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

No branches or pull requests

5 participants