autex 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- autex/__init__.py +7 -0
- autex/logging.py +83 -0
- autex-0.1.0.dist-info/METADATA +20 -0
- autex-0.1.0.dist-info/RECORD +6 -0
- autex-0.1.0.dist-info/WHEEL +5 -0
- autex-0.1.0.dist-info/top_level.txt +1 -0
autex/__init__.py
ADDED
autex/logging.py
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"""Centralized logging infrastructure for the autex reduction pipeline."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
import sys
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
_LOGGER: logging.Logger | None = None
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def setup_logger(
|
|
13
|
+
name: str = "autex",
|
|
14
|
+
log_file: str | Path | None = None,
|
|
15
|
+
level: int = logging.INFO,
|
|
16
|
+
) -> logging.Logger:
|
|
17
|
+
"""Configure and initialize the centralized pipeline logger.
|
|
18
|
+
|
|
19
|
+
Parameters
|
|
20
|
+
----------
|
|
21
|
+
name : str, optional
|
|
22
|
+
Name of the top-level logger instance, by default "autex".
|
|
23
|
+
log_file : str | Path | None, optional
|
|
24
|
+
Filesystem path to write runtime logs. If None, logs only to console.
|
|
25
|
+
level : int, optional
|
|
26
|
+
Logging severity threshold, by default logging.INFO.
|
|
27
|
+
|
|
28
|
+
Returns
|
|
29
|
+
-------
|
|
30
|
+
logging.Logger
|
|
31
|
+
Configured logger instance with attached streaming and file handlers.
|
|
32
|
+
"""
|
|
33
|
+
global _LOGGER
|
|
34
|
+
|
|
35
|
+
logger = logging.getLogger(name)
|
|
36
|
+
logger.setLevel(level)
|
|
37
|
+
|
|
38
|
+
if logger.handlers:
|
|
39
|
+
_LOGGER = logger
|
|
40
|
+
return logger
|
|
41
|
+
|
|
42
|
+
formatter = logging.Formatter(
|
|
43
|
+
fmt="[%(asctime)s] [%(levelname)-7s] [%(name)s]: %(message)s",
|
|
44
|
+
datefmt="%Y-%m-%d %H:%M:%S",
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
console_handler = logging.StreamHandler(sys.stdout)
|
|
48
|
+
console_handler.setFormatter(formatter)
|
|
49
|
+
console_handler.setLevel(level)
|
|
50
|
+
logger.addHandler(console_handler)
|
|
51
|
+
|
|
52
|
+
if log_file is not None:
|
|
53
|
+
path = Path(log_file).expanduser().resolve()
|
|
54
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
55
|
+
file_handler = logging.FileHandler(path, encoding="utf-8")
|
|
56
|
+
file_handler.setFormatter(formatter)
|
|
57
|
+
file_handler.setLevel(level)
|
|
58
|
+
logger.addHandler(file_handler)
|
|
59
|
+
|
|
60
|
+
logger.propagate = False
|
|
61
|
+
_LOGGER = logger
|
|
62
|
+
return logger
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def get_logger(child_name: str | None = None) -> logging.Logger:
|
|
66
|
+
"""Retrieve the active logger or create a child logger."""
|
|
67
|
+
global _LOGGER
|
|
68
|
+
if _LOGGER is None:
|
|
69
|
+
_LOGGER = setup_logger()
|
|
70
|
+
|
|
71
|
+
if child_name:
|
|
72
|
+
return _LOGGER.getChild(child_name)
|
|
73
|
+
return _LOGGER
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def log_section(title: str, char: str = "=", length: int = 70) -> None:
|
|
77
|
+
"""Write an eye-catching visual section divider into the active log."""
|
|
78
|
+
logger = get_logger()
|
|
79
|
+
separator = char * length
|
|
80
|
+
centered_title = f" {title.strip()} ".center(length, char)
|
|
81
|
+
logger.info(separator)
|
|
82
|
+
logger.info(centered_title)
|
|
83
|
+
logger.info(separator)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: autex
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Automated Near-Infrared Reduction and Extraction Pipeline
|
|
5
|
+
Author: Maddy
|
|
6
|
+
Requires-Python: >=3.9
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Requires-Dist: numpy>=1.22.0
|
|
9
|
+
Requires-Dist: scipy>=1.8.0
|
|
10
|
+
Requires-Dist: astropy>=5.0.0
|
|
11
|
+
Requires-Dist: matplotlib>=3.5.0
|
|
12
|
+
Requires-Dist: pyyaml>=6.0
|
|
13
|
+
Provides-Extra: dev
|
|
14
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
15
|
+
Requires-Dist: sphinx>=7.0; extra == "dev"
|
|
16
|
+
Requires-Dist: sphinx-rtd-theme>=1.2.0; extra == "dev"
|
|
17
|
+
Requires-Dist: flake8>=6.0; extra == "dev"
|
|
18
|
+
Requires-Dist: black>=23.0; extra == "dev"
|
|
19
|
+
|
|
20
|
+
# autex: Automated Near-Infrared Reduction Pipeline
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
autex/__init__.py,sha256=j-cHnQWpR-_6Yro8FdIXoB1efnBPUm_S1BsKY82-p9c,178
|
|
2
|
+
autex/logging.py,sha256=yjkRE5Uz7tn-MUnUQWlrYiwIJGfly5PQnmzHoEYvvHE,2387
|
|
3
|
+
autex-0.1.0.dist-info/METADATA,sha256=XgL1XYuBoyspnG0zfsGmg1AQlZ_B8h3UaE2rVKrfCsU,640
|
|
4
|
+
autex-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
5
|
+
autex-0.1.0.dist-info/top_level.txt,sha256=AH9aq5aOJPpYrR11pLWGIZtTMFcRFcgMOiV1-bKfXhY,6
|
|
6
|
+
autex-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
autex
|