Expand description
File to handle logging server events
This module defines functions to log different types of server events (startup, shutdown, errors) into the database. It uses a caching mechanism to minimize database queries for event type IDs, ensuring efficient logging.
StructsΒ§
- Event
Type πRecord
StaticsΒ§
- ERROR_
ID π - SHUTDOWN_
ID π - STARTUP_
ID π
FunctionsΒ§
- get_
cached_ πevent_ type - Gets the cached event type ID for the given event name, using a OnceLock to cache the ID after the first retrieval.
- get_
or_ πcreate_ event_ type - Gets the event type ID for the given event name, creating a new event type if it doesnβt already exist.
- log_
error - Logs an error event to the database with the given message and error code.
- log_
shutdown - Logs a shutdown event to the database with the given duration in milliseconds.
- log_
startup - Logs a startup event to the database with the given duration in milliseconds.