diff --git a/pyproject.toml b/pyproject.toml index 7e73d64..670b1df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ classifiers = [ "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", ] -dependencies = ["virtualenv >= 20.25", "pydantic"] # add all the dependencies here +dependencies = ["virtualenv >= 20.25", "pydantic", "colorlog"] # add all the dependencies here dynamic = ["readme", "version"] [project.urls] diff --git a/requirements.txt b/requirements.txt index e0c0601..5a98a7a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,6 +6,10 @@ # annotated-types==0.6.0 # via pydantic +colorama==0.4.6 + # via colorlog +colorlog==6.8.2 + # via migmose (pyproject.toml) distlib==0.3.8 # via virtualenv filelock==3.13.1 diff --git a/src/migmose/logger.ini b/src/migmose/logger.ini new file mode 100644 index 0000000..46b7aac --- /dev/null +++ b/src/migmose/logger.ini @@ -0,0 +1,22 @@ +[loggers] +keys=root + +[logger_root] +handlers=stream +level=DEBUG + +[formatters] +keys=color + +[formatter_color] +class=colorlog.ColoredFormatter +format=%(log_color)s%(levelname)-8s [%(name)s] %(message)s +datefmt=%H:%M:%S + +[handlers] +keys=stream + +[handler_stream] +class=StreamHandler +formatter=color +args=() diff --git a/src/migmose/logger.py b/src/migmose/logger.py new file mode 100644 index 0000000..0e3658b --- /dev/null +++ b/src/migmose/logger.py @@ -0,0 +1,12 @@ +""" +This module provides a logger instance for migmose +""" + +import logging.config +from pathlib import Path + +# Construct the path to the configuration file +logger_config_file: Path = Path(__file__).with_suffix(".ini") + +logging.config.fileConfig(logger_config_file) +logger = logging.getLogger("migmose")