SourceHorizon / logger

Small, easy to use and extensible logger which prints beautiful logs.
https://pub.dev/packages/logger
MIT License
197 stars 33 forks source link

Adapt the severities/levels of Syslog (Unix) #31

Closed diegocatalao closed 1 year ago

diegocatalao commented 1 year ago

Hello, folks.

I'm little confused with Level.nothing. It's an accessible log level from another context but the log function throw an Exception('Log events cannot have Level.nothing').

What is the point to have this level?

Bungeefan commented 1 year ago

Hi, to be honest, I don't know.

It was included in the initial commit and has only minimally changed since then, I guess there were plans on using it for special cases. But now we could only remove it in a major version upgrade, because it changes the publicly available API.

diegocatalao commented 1 year ago

Hey, @Bungeefan!

I understood! Would it be possible to default in version 2.x.x to the default severity of the unix system?

We would have better grip with other systems with this pattern I suppose.

Bungeefan commented 1 year ago

I have to correct myself, it is probably used to turn off logging. It is higher than wtf and a LogEvent cannot have it, therefore, there would be no logging. It is similar to an OFF level.

Bungeefan commented 1 year ago

Regarding your request:

diegocatalao commented 1 year ago

Hello, @Bungeefan. Tks for reply.

What do you mean by "standard gravity"?

The severity that the Unix system has adopted;

And your idea is to adapt the nomenclature of our levels to Syslog severities?

Yep

Any reason you can't map your system's levels to our existing levels, are you missing one specifically?

Yes, I use this library to send logs to log servers like Grafana and others. At the end of the day, I'd like to adapt the severity levels so the other logging tools can understand what's coming up. In this current version we cannot use another Enum Level. Most systems (I could be absolutely wrong) adopt the severity of the Unix system. Having more levels of logging would more granularize the issues involved across multiple systems.

Bungeefan commented 1 year ago

So if I understand you correctly, you are not missing a specific log level, you just want the same ones as Syslog (or as you call it: Unix) uses?

My opinion: More common log levels are sure a good thing, however I am not really a fan of the same as the syslog ones. I would be more inclined to orient us on other popular and more modern logging frameworks, for example, log4j, slf4j, dart:logging or even log4net (which just combines all levels). And besides that, you can mostly map the existing levels to syslog levels already. I am actually already working on a commit for 2.0.0 to bring the log levels more in line with other popular logging frameworks.

However, people are free to comment and vote on your approach!

diegocatalao commented 1 year ago

Perfect @Bungeefan!

I understand and agree. Thanks for the answers. I'll wait for version 2.0.0. For now I will continue to send the levels as they are configured today.