katzgrau / KLogger

A Simple Logging Class For PHP
http://codefury.net/projects/klogger/
980 stars 284 forks source link

log method not PSR-3 compliant #97

Open gian-hancock opened 5 years ago

gian-hancock commented 5 years ago

The PSR-3 specification states:

A ninth method, log, accepts a log level as the first argument. Calling this method with one of the log level constants MUST have the same result as calling the level-specific method. Calling this method with a level not defined by this specification MUST throw a Psr\Log\InvalidArgumentException if the implementation does not know about the level. Users SHOULD NOT use a custom level without knowing for sure the current implementation supports it.

Currently calling log with any level not specified in PSR-3 will write the log regardless of the current log threshold and give an undefined index notice.

gian-hancock commented 5 years ago

If it is intentional that the log method accepts arbitrary log levels, then it could be argued that this implementation "knows about" all log levels and therefore is PSR-3 compliant. In this case it could be documented and the code updated so that notices aren't generated. However it would still be true that the log level threshold would have no effect on non PSR-3 log levels.