You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently (v. 1.2.1) all the warnings are logged using the root logger which isn't very helpful since the logging messages do not identify which module emitted the warning message, which is especially problematic when using sagan in scripts that include other libraries that also don't use named loggers.
For libraries, the best practice for logging is to use Loggers with name __name__ to ensure no name collisions.
The text was updated successfully, but these errors were encountered:
I have a handy code snippet that I use these days to keep logging easy. Maybe this would help?
importloggingclassLogMixin(object):
""" Use this mixin to do logging: self.logger.debug("My debugging message") """_logger=None@propertydeflogger(self):
ifself._logger:
returnself._loggerself._logger=logging.getLogger(self.__class__.__module__)
returnself.logger
cunha
added a commit
to cunha/ripe-atlas-sagan
that referenced
this issue
Jun 16, 2021
The library currently uses the root logger, which prevents
applications from separating their logs from the library's.
With this change, applications can silence or redirect sagan
logs by reconfiguring the "ripe" logger. In particular, the
following will print only `FATAL` messages from sagan:
```
def main():
ripe_logger = logging.getLogger("ripe")
ripe_logger.setLevel(logging.FATAL)
...
```
closeRIPE-NCC#89
Currently (v. 1.2.1) all the warnings are logged using the root logger which isn't very helpful since the logging messages do not identify which module emitted the warning message, which is especially problematic when using sagan in scripts that include other libraries that also don't use named loggers.
For libraries, the best practice for logging is to use Loggers with name
__name__
to ensure no name collisions.The text was updated successfully, but these errors were encountered: