Logger configuration is integrated into outflow to facilitate logging from the different plugins. By default a simple configuration and formatter is loaded, you can override them in your config.yml file.
Logging from tasks¶
The logger object in the logging module of outflow core is already set up with all the registered plugins:
#inside a tasks.py file from outflow.core.logging import logger @Task.as_task() def MyTask(): logger.info("Hello from MyTask")
2021-09-30 14:17:43,459 - my_project.my_plugin - tasks.py:15 - INFO - Hello from MyTask
Since the outflow logger looks at the calling module to route the logs, you tasks must be imported using the namespace convention and not with an absolute import:
#inside a commands.py file #do this from my_project.my_plugin import MyTask #not this from plugins.my_plugin.my_project.my_plugin.tasks import MyTask
Configuring your logger¶
The syntax of the logging section of the config.yml file is the same as a DictConfig from the logging module. In it, you can configure the level, handlers etc.. of the logs. (see python documentation about logging configuration for more details)
logging: loggers: matplotlib: level: WARNING handlers: ["console"] my_plugin: level: DEBUG handlers: ["console"] my_another_plugin: level: ERROR handlers: ["console"]
Log to a file¶
Should work. Fix in outflow and write documentation.