pywry.log¶
Logging utilities for PyWry.
Logger Access¶
pywry.log.get_logger
¶
Get the pywry logger instance.
| RETURNS | DESCRIPTION |
|---|---|
Logger
|
The pywry logger configured with a stream handler. |
pywry.log.set_level
¶
Set the logging level.
| PARAMETER | DESCRIPTION |
|---|---|
level
|
The logging level (e.g., logging.DEBUG, "DEBUG").
TYPE:
|
pywry.log.enable_debug
¶
Enable debug mode for verbose IPC and operation logging.
This will show all debug messages including: - IPC command calls and responses - Event routing - Template application - Asset loading
Log Functions¶
pywry.log.debug
¶
Log a debug message.
| PARAMETER | DESCRIPTION |
|---|---|
msg
|
The message to log.
TYPE:
|
pywry.log.info
¶
Log an info message.
| PARAMETER | DESCRIPTION |
|---|---|
msg
|
The message to log.
TYPE:
|
pywry.log.warn
¶
Log a warning message. Never raises exceptions.
| PARAMETER | DESCRIPTION |
|---|---|
msg
|
The warning message to log.
TYPE:
|
pywry.log.error
¶
Log an error message. Never raises exceptions.
| PARAMETER | DESCRIPTION |
|---|---|
msg
|
The error message to log.
TYPE:
|
pywry.log.exception
¶
Log an exception with full traceback.
Call this from within an except block to log the exception message along with the full stack trace.
| PARAMETER | DESCRIPTION |
|---|---|
msg
|
The error message to log alongside the traceback.
TYPE:
|
Helpers¶
pywry.log.log_callback_error
¶
Log a callback error with standardized format.
| PARAMETER | DESCRIPTION |
|---|---|
event_type
|
The event type that triggered the callback.
TYPE:
|
label
|
The window label where the event occurred.
TYPE:
|
exc
|
The exception that was raised.
TYPE:
|
pywry.log.redact_sensitive_data
¶
redact_sensitive_data(data: dict[str, Any] | list[Any] | str | None, max_depth: int = 5) -> dict[str, Any] | list[Any] | str | None
Redact sensitive values from data for safe logging.
Recursively traverses dicts/lists and replaces values for keys that match sensitive patterns with "[REDACTED]".
| PARAMETER | DESCRIPTION |
|---|---|
data
|
The data to redact.
TYPE:
|
max_depth
|
Maximum recursion depth to prevent infinite loops (default: 5).
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict or list or str or None
|
A copy of the data with sensitive values redacted. |