2020-02-21 23:44:15 +01:00
|
|
|
import logging
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
# create logger
|
2023-07-01 04:53:38 +02:00
|
|
|
logger = logging.getLogger("simple_example")
|
2020-02-21 23:44:15 +01:00
|
|
|
logger.setLevel(logging.DEBUG)
|
|
|
|
|
|
|
|
# create console handler and set level to INFO
|
|
|
|
console_logger = logging.StreamHandler()
|
|
|
|
console_logger.setLevel(logging.INFO)
|
|
|
|
|
|
|
|
# create formatter
|
2023-07-01 04:53:38 +02:00
|
|
|
formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")
|
2020-02-21 23:44:15 +01:00
|
|
|
|
|
|
|
# add formatter to console_logger
|
|
|
|
console_logger.setFormatter(formatter)
|
|
|
|
|
|
|
|
# add console_logger to logger
|
2023-07-01 04:53:38 +02:00
|
|
|
logger.addHandler(console_logger)
|