API Reference¶
logxide
¶
LogXide: High-performance, Rust-powered drop-in replacement for Python's logging module.
LogXide provides a fast, async-capable logging system that maintains full compatibility with Python's standard logging module while delivering superior performance through its Rust backend.
FileHandler
¶
Bases: StreamHandler
File handler class - compatible with logging.FileHandler
Source code in logxide/compat_handlers.py
Formatter
¶
Enhanced formatter - compatible with logging.Formatter, supports extra fields
Source code in logxide/compat_handlers.py
format(record)
¶
NO-OP formatter - ALL formatting is now handled in Rust.
This method should never be called if you're using the pure Rust pipeline. For maximum performance, use logxide.register_console_handler() or logxide.register_file_handler() instead of Python handlers.
If this method is called, it means you're using Python handlers for compatibility. The real formatting should have been done in Rust already.
Source code in logxide/compat_handlers.py
formatException(ei)
¶
Format exception information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ei
|
Exception info tuple (type, value, traceback) |
required |
Returns:
Type | Description |
---|---|
Formatted exception string |
Source code in logxide/compat_handlers.py
formatStack(stack_info)
¶
Format stack information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stack_info
|
Stack info string |
required |
Returns:
Type | Description |
---|---|
Formatted stack string |
formatTime(record, datefmt=None)
¶
Format the time for a record.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
record
|
LogRecord instance |
required | |
datefmt
|
Date format string (if None, uses default format) |
None
|
Returns:
Type | Description |
---|---|
Formatted time string |
Source code in logxide/compat_handlers.py
Handler
¶
Basic handler class - compatible with logging.Handler
Source code in logxide/compat_handlers.py
LoggingManager
¶
NullHandler
¶
A handler that does nothing - compatible with logging.NullHandler
Source code in logxide/compat_handlers.py
SentryHandler
¶
Bases: Handler
A handler that sends log records to Sentry.
Automatically detects if Sentry SDK is available and configured. Only sends events at WARNING level and above to avoid noise.
Source code in logxide/sentry_integration.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
|
is_available
property
¶
Check if Sentry is available and configured.
__call__(record)
¶
__init__(level=WARNING, with_breadcrumbs=True)
¶
Initialize the Sentry handler.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
level
|
int
|
Minimum log level to send to Sentry (default: WARNING) |
WARNING
|
with_breadcrumbs
|
bool
|
Whether to add breadcrumbs for lower-level logs |
True
|
Source code in logxide/sentry_integration.py
emit(record)
¶
Emit a log record to Sentry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
record
|
The log record to emit |
required |
Source code in logxide/sentry_integration.py
StreamHandler
¶
Bases: Handler
Stream handler class - compatible with logging.StreamHandler
Source code in logxide/compat_handlers.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 |
|
close()
¶
Close the stream.
Source code in logxide/compat_handlers.py
addLevelName(level, levelName)
¶
auto_configure_sentry(enable=None)
¶
Automatically configure Sentry integration if available.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
enable
|
Optional[bool]
|
Explicitly enable/disable Sentry (None for auto-detect) |
None
|
Returns:
Type | Description |
---|---|
Optional[SentryHandler]
|
SentryHandler instance if configured, None otherwise |
Source code in logxide/sentry_integration.py
basicConfig(**kwargs)
¶
Basic configuration for the logging system.
Supported parameters: - level: Set the effective level for the root logger - format: Format string for log messages - datefmt: Date format string
Source code in logxide/logger_wrapper.py
disable(level)
¶
getLevelName(level)
¶
Get level name - compatibility function
Source code in logxide/compat_functions.py
getLogger(name=None)
¶
Get a logger by name, ensuring existing loggers get LogXide functionality.
This wraps the Rust getLogger to handle cases where Python libraries created loggers before LogXide was configured.
Source code in logxide/logger_wrapper.py
getLoggerClass()
¶
Get the logger class - compatibility function
Source code in logxide/compat_functions.py
setLoggerClass(klass)
¶
uninstall()
¶
Restore the standard logging module.
This undoes the monkey-patching done by _install().