Skip to content

Commit bf020bc

Browse files
committed
Adds basic logging configuration
Adds a basic logging configuration to pydeepskylog. This commit introduces a `logging_config.py` module which contains a function to configure the Python logging system with a basic format and date format. The default logging level is WARNING, which can be adjusted as needed.
1 parent d1dbc96 commit bf020bc

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

pydeepskylog/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
from .deepskylog_interface import (dsl_instruments, dsl_eyepieces, dsl_lenses, dsl_filters,
55
calculate_magnifications,
66
convert_instrument_type_to_string, convert_instrument_type_to_int)
7+
from .logging_config import configure_logging
8+
import logging
9+
10+
configure_logging(logging.WARNING)
711

812
__all__ = ["__version__", "contrast_reserve", "optimal_detection_magnification", "surface_brightness", "nelm_to_sqm",
913
"nelm_to_bortle", "sqm_to_nelm", "sqm_to_bortle", "bortle_to_nelm", "bortle_to_sqm", "dsl_instruments",

pydeepskylog/logging_config.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# pydeepskylog/logging_config.py
2+
import logging
3+
4+
def configure_logging(level: int = logging.INFO) -> None:
5+
logging.basicConfig(
6+
level=level,
7+
format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
8+
datefmt="%Y-%m-%d %H:%M:%S"
9+
)

0 commit comments

Comments
 (0)