Logging
boogr ¶
SQLite-backed exception wrapping and logging utilities for Leeroy.
Purpose
Defines the application exception wrapper and logger used by Leeroy source files to capture structured diagnostic metadata and persist failure records to the configured SQLite exception database. The module centralizes error metadata, traceback capture, and database writes so application code can use a consistent logging pattern without duplicating SQLite setup or traceback formatting logic.
Error ¶
Bases: Exception
Wrap an exception with application-specific diagnostic metadata.
Purpose
Captures the original exception, active traceback text, optional display heading,
logical cause, source module, and stable method signature used by Leeroy exception
handlers. The wrapper provides a consistent diagnostic object that can be raised by
application code and written by Logger without forcing each caller to format
traceback details manually.
Attributes:
| Name | Type | Description |
|---|---|---|
exception |
Original exception instance being wrapped. |
|
heading |
Optional display heading associated with the error. |
|
cause |
Logical component or class responsible for the failure. |
|
method |
Stable method or function signature where the failure occurred. |
|
module |
Source module where the failure occurred. |
|
type |
Active exception type reported by |
|
trace |
Formatted traceback text captured when the wrapper is constructed. |
|
info |
Combined exception type and formatted traceback text. |
Source code in boogr.py
Logger ¶
Persist wrapped exception details to the configured SQLite logging database.
Purpose
Writes Error metadata to the SQLite database identified by config.LOG_PATH
and the table identified by config.LOG_FILE. The class creates the logging
directory and exception table when needed, then records cause, module, method,
message, formatted diagnostic information, traceback text, and creation time for
later troubleshooting.
Attributes:
| Name | Type | Description |
|---|---|---|
path |
Filesystem path to the SQLite logging database. |
|
table |
SQLite table name used for persisted exception records. |
|
query |
SQL statement prepared for the active logging operation. |
|
values |
Values prepared for the active logging operation. |
Source code in boogr.py
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 | |
create_table ¶
Create the exception table when it does not already exist.
Purpose
Ensures the logging directory and SQLite exception table exist before exception records are written. The schema stores stable diagnostic fields used by Leeroy modules and suppresses setup failures so logging does not mask the original application exception.
Source code in boogr.py
write ¶
Write an error record to the logging database.
Purpose
Persists a wrapped Error object to the configured SQLite database using the
standard Leeroy exception schema. Logging is intentionally failure-safe so a
database or filesystem problem during logging does not suppress or replace the
original application error.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
error
|
Error
|
Wrapped exception object containing diagnostic metadata to persist. |
required |