Closed Skazu closed 3 years ago
Hi and thanks for the request.
log_exception
uses logging.exception
under the hood. Since logging.exception
logs only to the ERROR
log level, I decided to throw a user warning in order to avoid confusion, when the log messages are not logged to the given level.
Please have a look at https://docs.python.org/3/library/logging.html#logging.exception for further information.
Ah i see,
but then whats the reason for the log_level
constructor argument? Wouldn't it be more intuitive to drop this argument and stick hard to logging.ERROR
in the super().__init__(...)
call?
Indeed, this is a bit confusing. I'll evaluate this as a candidate for some future release.
This change will be available in logdecorator 2.2 and is already implemented in the release branch #7
PR was merged into master branch.
Hello, the
log_exception
decorator tries to force me to log on levelERROR
instead ofCRITICAL/FATAL
or any self defined level, if i use one of those levels i get the following warning:UserWarning: `log_exception` can only log into ERROR log level
What's the intention behind this warning? Why is this decorator bound to this specific log level?