haive.core.utils.debugkit.logging.structuredΒΆ
Enhanced Logging Utilities
Provides beautiful, structured logging with Rich integration, context awareness, and development-friendly features.
ClassesΒΆ
Enhanced development logger with rich formatting and context. |
|
Custom formatter for non-Rich environments. |
Module ContentsΒΆ
- class haive.core.utils.debugkit.logging.structured.DevLogger(name='haive.dev')[source]ΒΆ
Enhanced development logger with rich formatting and context.
- Parameters:
name (str)
- context(name, **kwargs)[source]ΒΆ
Context manager for adding context to logs.
- Parameters:
name (str)
- debug(message, **kwargs)[source]ΒΆ
Log debug message with context.
- Parameters:
message (str)
- Return type:
None
- info(message, **kwargs)[source]ΒΆ
Log info message with context.
- Parameters:
message (str)
- Return type:
None
- json(data, title='JSON Data')[source]ΒΆ
Log data as formatted JSON.
- Parameters:
data (Any)
title (str)
- Return type:
None
- progress(message, **kwargs)[source]ΒΆ
Log progress message.
- Parameters:
message (str)
- Return type:
None
- success(message, **kwargs)[source]ΒΆ
Log success message.
- Parameters:
message (str)
- Return type:
None
- class haive.core.utils.debugkit.logging.structured.RichFormatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)[source]ΒΆ
Bases:
logging.Formatter
Custom formatter for non-Rich environments.
Initialize the formatter with specified format strings.
Initialize the formatter either with the specified format string, or a default as described above. Allow for specialized date formatting with the optional datefmt argument. If datefmt is omitted, you get an ISO8601-like (or RFC 3339-like) format.
Use a style parameter of β%β, β{β or β$β to specify that you want to use one of %-formatting,
str.format()
({}
) formatting orstring.Template
formatting in your format string.Changed in version 3.2: Added the
style
parameter.- format(record)[source]ΒΆ
Format the specified record as text.
The recordβs attribute dictionary is used as the operand to a string formatting operation which yields the returned string. Before formatting the dictionary, a couple of preparatory steps are carried out. The message attribute of the record is computed using LogRecord.getMessage(). If the formatting string uses the time (as determined by a call to usesTime(), formatTime() is called to format the event time. If there is exception information, it is formatted using formatException() and appended to the message.