Logging
Integration with the standard library logging module.
LogfireLoggingHandler ¶
LogfireLoggingHandler(
level: int | str = NOTSET,
fallback: Handler = StreamHandler(),
logfire_instance: Logfire | None = None,
)
Bases: Handler
A logging handler that sends logs to Logfire.
Source code in logfire/integrations/logging.py
57 58 59 60 61 62 63 64 65 66 67 |
|
emit ¶
Send the log to Logfire.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
LogRecord
|
The log record to send. |
required |
Source code in logfire/integrations/logging.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
fill_attributes ¶
Fill the attributes to send to Logfire.
This method can be overridden to add more attributes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
LogRecord
|
The log record. |
required |
Returns:
Type | Description |
---|---|
dict[str, Any]
|
The attributes for the log record. |
Source code in logfire/integrations/logging.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
|