hydra-structlog 1.0.1__tar.gz → 1.0.2__tar.gz
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.
- {hydra_structlog-1.0.1 → hydra_structlog-1.0.2}/PKG-INFO +1 -1
- {hydra_structlog-1.0.1 → hydra_structlog-1.0.2}/pyproject.toml +1 -1
- {hydra_structlog-1.0.1 → hydra_structlog-1.0.2}/pyproject.toml.orig +1 -1
- hydra_structlog-1.0.2/src/hydra_structlog/__init__.py +1 -0
- {hydra_structlog-1.0.1 → hydra_structlog-1.0.2}/src/hydra_structlog/conf/hydra/job_logging/structlog.yaml +3 -0
- {hydra_structlog-1.0.1 → hydra_structlog-1.0.2}/src/hydra_structlog/init.py +11 -5
- hydra_structlog-1.0.1/src/hydra_structlog/__init__.py +0 -1
- {hydra_structlog-1.0.1 → hydra_structlog-1.0.2}/LICENSE +0 -0
- {hydra_structlog-1.0.1 → hydra_structlog-1.0.2}/README.md +0 -0
- {hydra_structlog-1.0.1 → hydra_structlog-1.0.2}/src/hydra_plugins/hydra_structlog/__init__.py +0 -0
- {hydra_structlog-1.0.1 → hydra_structlog-1.0.2}/src/hydra_plugins/hydra_structlog/py.typed +0 -0
- {hydra_structlog-1.0.1 → hydra_structlog-1.0.2}/src/hydra_structlog/conf/__init__.py +0 -0
- {hydra_structlog-1.0.1 → hydra_structlog-1.0.2}/src/hydra_structlog/formatters.py +0 -0
- {hydra_structlog-1.0.1 → hydra_structlog-1.0.2}/src/hydra_structlog/handlers.py +0 -0
- {hydra_structlog-1.0.1 → hydra_structlog-1.0.2}/src/hydra_structlog/plugin.py +0 -0
- {hydra_structlog-1.0.1 → hydra_structlog-1.0.2}/src/hydra_structlog/processors.py +0 -0
- {hydra_structlog-1.0.1 → hydra_structlog-1.0.2}/src/hydra_structlog/py.typed +0 -0
- {hydra_structlog-1.0.1 → hydra_structlog-1.0.2}/src/hydra_structlog/resolvers.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.0.2"
|
|
@@ -58,6 +58,7 @@ formatters:
|
|
|
58
58
|
- func_name
|
|
59
59
|
additional_ignores:
|
|
60
60
|
- warnings
|
|
61
|
+
- _py_warnings
|
|
61
62
|
- hydra_structlog
|
|
62
63
|
time_stamper:
|
|
63
64
|
_target_: structlog.processors.TimeStamper
|
|
@@ -67,6 +68,8 @@ formatters:
|
|
|
67
68
|
level: status
|
|
68
69
|
event: message
|
|
69
70
|
_event: event
|
|
71
|
+
_warn_lineno: lineno
|
|
72
|
+
_warn_func_name: func_name
|
|
70
73
|
format_exc_info:
|
|
71
74
|
_target_: structlog.processors.format_exc_info
|
|
72
75
|
_partial_: true
|
|
@@ -14,19 +14,19 @@ _excepthook = None
|
|
|
14
14
|
_configured_once = False
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
def _module_from_filename(filename: str) -> str | None:
|
|
17
|
+
def _module_from_filename(filename: str) -> tuple[str | None, str | None]:
|
|
18
18
|
"""Obtain the module name from filename through call stack."""
|
|
19
19
|
frame = sys._getframe(1)
|
|
20
20
|
while frame is not None:
|
|
21
21
|
if frame.f_code.co_filename == filename:
|
|
22
|
-
return frame.f_globals.get("__name__")
|
|
22
|
+
return frame.f_globals.get("__name__"), frame.f_code.co_name
|
|
23
23
|
frame = frame.f_back
|
|
24
24
|
|
|
25
25
|
# Fallback: Module from sys.modules
|
|
26
26
|
for name, mod in list(sys.modules.items()):
|
|
27
27
|
if getattr(mod, "__file__", None) == filename:
|
|
28
|
-
return name
|
|
29
|
-
return None
|
|
28
|
+
return name, None
|
|
29
|
+
return None, None
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
def warning_logger(
|
|
@@ -38,10 +38,14 @@ def warning_logger(
|
|
|
38
38
|
line: str | None = None,
|
|
39
39
|
) -> None:
|
|
40
40
|
"""Emit Python-native warnings as logging warnings."""
|
|
41
|
-
module = _module_from_filename(filename)
|
|
41
|
+
module, func_name = _module_from_filename(filename)
|
|
42
42
|
logger = logging.getLogger(module)
|
|
43
43
|
if not logger.isEnabledFor(logging.WARNING):
|
|
44
44
|
return # pragma: no cover
|
|
45
|
+
extra = {
|
|
46
|
+
"_warn_func_name": func_name,
|
|
47
|
+
"_warn_lineno": lineno,
|
|
48
|
+
}
|
|
45
49
|
record = logger.makeRecord(
|
|
46
50
|
logger.name,
|
|
47
51
|
logging.WARNING,
|
|
@@ -50,6 +54,8 @@ def warning_logger(
|
|
|
50
54
|
"%s: %s (line %d)",
|
|
51
55
|
(category.__name__, message, lineno),
|
|
52
56
|
None,
|
|
57
|
+
func=func_name,
|
|
58
|
+
extra=extra if func_name else None,
|
|
53
59
|
)
|
|
54
60
|
logger.handle(record)
|
|
55
61
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.0.1"
|
|
File without changes
|
|
File without changes
|
{hydra_structlog-1.0.1 → hydra_structlog-1.0.2}/src/hydra_plugins/hydra_structlog/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|