Seldaek / monolog

Sends your logs to files, sockets, inboxes, databases and various web services
https://seldaek.github.io/monolog/
MIT License
21.04k stars 1.9k forks source link

Log level not compliant with rfc5424 #1892

Open anthosz opened 5 months ago

anthosz commented 5 months ago

Hello,

Following https://github.com/Seldaek/monolog/blob/main/doc/01-usage.md#log-levels: image

There is strange level for each severity especially if it's supposed to be compliant with rfc5424.

In fact, it's not really the case. According to https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1 (table 2): "Severity values MUST be in the range of 0 to 7 inclusive."

Could you please change it?

It can lead to some issues during parsing from some log parsers ootb.

Thank you!

Seldaek commented 4 months ago

You can make sure your formatters use $record->level->toRFC5424Level() to format stuff to get compliant levels if you care about the actual level used. The syslog formatter for example uses that.

The internal levels are the way they are for BC reasons and I don't think they should be changed. Maybe something for v4 though if we could add a way to opt-in to it in v3 ideally.. I'll leave this open for now as reminder.

anthosz commented 4 months ago

Thank you for your feedback and let's see :)