Core
๐ค AI-Generated Content
This documentation was generated with AI assistance and is still being audited. Some, or potentially a lot, of this information may be inaccurate. Learn more.
provide.foundation.logger.core
¶
Attributes¶
Classes¶
FoundationLogger
¶
A structlog-based logger providing a standardized logging interface.
Source code in provide/foundation/logger/core.py
Functions¶
bind
¶
critical
¶
Log critical-level event.
debug
¶
error
¶
exception
¶
Log error-level event with exception traceback.
Source code in provide/foundation/logger/core.py
info
¶
is_debug_enabled
¶
Check if debug-level logging is enabled.
Use this to guard expensive argument construction::
if logger.is_debug_enabled():
logger.debug("result", payload=model.model_dump_json())
Source code in provide/foundation/logger/core.py
is_trace_enabled
¶
setup
¶
Setup the logger with configuration from Hub.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
TelemetryConfig
|
TelemetryConfig to use for setup |
required |
Source code in provide/foundation/logger/core.py
trace
¶
Log trace-level event for detailed debugging.
Source code in provide/foundation/logger/core.py
try_unbind
¶
Create a new logger with specified keys removed from context. Does not raise an error if keys don't exist.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*keys
|
str
|
Context keys to remove |
()
|
Returns:
| Type | Description |
|---|---|
Any
|
A new logger instance without the specified keys |
Source code in provide/foundation/logger/core.py
unbind
¶
warning
¶
Log warning-level event.
GlobalLoggerProxy
¶
Proxy object that forwards all attribute access to Hub-based logger.
Functions¶
__setattr__
¶
Allow tests to set internal state on the underlying logger.
Source code in provide/foundation/logger/core.py
is_debug_enabled
¶
Functions¶
get_global_logger
¶
Get the global FoundationLogger instance through Hub.
This function acts as the Composition Root for the global logger instance, maintained for backward compatibility.
Note: For building testable and maintainable applications, the recommended
approach is to inject a logger instance via a Container. This global
accessor should be avoided in new application code.
Returns:
| Type | Description |
|---|---|
FoundationLogger
|
FoundationLogger instance from Hub |
Source code in provide/foundation/logger/core.py
is_debug_enabled
¶
Standalone check if debug-level logging is enabled.
Use to guard expensive argument construction::
from provide.foundation.logger import is_debug_enabled
if is_debug_enabled():
logger.debug("result", payload=model.model_dump_json())