Closed LexiconCode closed 5 months ago
Removing default_logger.setLevel(logging.DEBUG)
is a fix but if the fails loader it may not be logged as DEBUG
https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library "Note It is strongly advised that you do not log to the root logger in your library. Instead, use a logger with a unique and easily identifiable name, such as the name for your library’s top-level package or module. Logging to the root logger will make it difficult or impossible for the application developer to configure the logging verbosity or handlers of your library as they wish.
Note It is strongly advised that you do not add any handlers other than NullHandler to your library’s loggers. This is because the configuration of handlers is the prerogative of the application developer who uses your library. The application developer knows their target audience and what handlers are most appropriate for their application: if you add handlers ‘under the hood’, you might well interfere with their ability to carry out unit tests and deliver logs which suit their requirements."
This should be fixed now in the above PR utilizing named loggers instead of setting root longer.
The root natlink logger is set to debug. This seems to be inherited by dragonfly setting it to debug as well.
Steps to reproduce:
natlink gui window log
The root natlink logger is set to debug in the loader. This seems to be inherited by dragonfly setting it to debug as well. https://github.com/dictation-toolbox/natlinkcore/blob/2dd7df495cff67dc05e786666d268dfaa18763b1/src/natlinkcore/loader.py#L669-L678
Setting the
default_logger.setLevel(logging.DEBUG)
to info changes Dragonfly logging levels.Info: Natlinkcore config default logging is info but does not change Dragonfly logging. https://github.com/dictation-toolbox/natlinkcore/blob/2dd7df495cff67dc05e786666d268dfaa18763b1/src/natlinkcore/loader.py#L694-L698
https://github.com/dictation-toolbox/natlinkcore/blob/2dd7df495cff67dc05e786666d268dfaa18763b1/src/natlinkcore/loader.py#L544-L552
Dragonfly default logging levels https://github.com/dictation-toolbox/dragonfly/blob/a0682dcc64ac02deb4f5ddafdc1236d6fe007367/dragonfly/log.py#L70-L104
Dragonfly logging setup https://github.com/dictation-toolbox/dragonfly/blob/a0682dcc64ac02deb4f5ddafdc1236d6fe007367/dragonfly/log.py#L216-L232
Expected out come: Natlink logging level should not affect Dragonfly logging.