File: advanced_extra.py

package info (click to toggle)
python-daiquiri 3.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 208 kB
  • sloc: python: 795; makefile: 5
file content (27 lines) | stat: -rw-r--r-- 656 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import logging

import daiquiri
import daiquiri.formatter

daiquiri.setup(
    level=logging.INFO,
    outputs=[
        daiquiri.output.Stream(
            formatter=daiquiri.formatter.ColorExtrasFormatter(
                fmt=(
                    daiquiri.formatter.DEFAULT_FORMAT
                    + " [%(subsystem)s is %(mood)s]"
                    + "%(extras)s"
                ),
                keywords=["mood", "subsystem"],
            )
        )
    ],
)

logger = daiquiri.getLogger(__name__, subsystem="example")
logger.info(
    "It works and log to stderr by default with color!",
    mood="happy",
    arbitrary_context="included",
)