Skip to content

Parse log config from args config instead of a file in configparser format

TChin requested to merge log-config-dict into main

This lets you configure logging directly from configuration instead of needing a seperate file.

i.e. Something like

# log_config.ini
[loggers]
keys=root

[handlers]
keys=consoleHandler

[formatters]
keys=ecsStdLibFormatter

[logger_root]
level=DEBUG
handlers=consoleHandler

[handler_consoleHandler]
class=StreamHandler
formatter=ecsStdLibFormatter
args=(sys.stdout,)

[formatter_ecsStdLibFormatter]
class=ecs_logging.StdlibFormatter

Becomes:

# config.yaml
stream_manager:
  # ...

log_config:
  root:
    level: DEBUG
    handler: consoleHandler

  handlers:
    consoleHandler:
      class: logging.StreamHandler
      formatter: ecsStdLibFormatter
      stream  : ext://sys.stdout

  formatters:
    ecsStdLibFormatter:
      class: ecs_logging.StdlibFormatter
Edited by TChin

Merge request reports