Expand description
§systemprompt-logging
Tracing and audit infrastructure for systemprompt.io. Owns the
structured-event pipeline, the database-backed tracing layer,
log/analytics repositories, and the CLI display
sinks. The trace-assembly queries over agent, AI and MCP tables live in
systemprompt_runtime::trace.
§Feature flags
| Feature | Description |
|---|---|
| (default) | Database layer, repositories |
cli | CLI display helpers (CliService, tables, banners) — pulls in console, indicatif |
§Top-level entry points
init_logging/init_console_logging/init_console_logging_with_level— install the globaltracingsubscriber (with optional database sink) and return itsLogSink.LoggingRuntime— the sink paired with the platform owner; built once at bootstrap and carried byAppContext.OutputState::set_console_format— switch stderr between text and JSON lines (observability.log_format); both redact the same fields.LogSink::shutdown— flush the database sink’s buffered and queued entries and stop its writer task; awaited on server shutdown.LoggingExtension— schema/extension registration via theinventoryframework.LoggingRepository,AnalyticsRepository— direct repository access.
§Process state
The tracing subscriber is the one process singleton: tracing installs
its global dispatcher once, so the crate mirrors it with a set-once guard,
and the CLI output-mode flags ride with it. Everything else — the database
sink, the instance label, the drop count, the platform owner — is owned by
the LogSink / LoggingRuntime values. A sink is recovered from the
installed dispatcher rather than from a crate-level cell.
Copyright (c) systemprompt.io — Business Source License 1.1. See https://systemprompt.io for licensing details.
Re-exports§
pub use extension::LoggingExtension;pub use layer::DatabaseLayer;pub use layer::LogWriterHandle;pub use layer::LogWriterShutdownError;pub use models::LogActor;pub use models::LogEntry;pub use models::LogFilter;pub use models::LogLevel;pub use repository::AnalyticsEvent;pub use repository::AnalyticsRepository;pub use repository::LoggingOwnerReassignment;pub use repository::LoggingRepository;pub use runtime::LogSink;pub use runtime::LoggingRuntime;pub use services::CliService;pub use services::BufferedNotice;pub use services::ConsoleEventFormat;pub use services::DatabaseLogService;pub use services::FilterSystemFields;pub use services::JsonEventFormat;pub use services::LogThrottle;pub use services::LoggingMaintenanceService;pub use services::OutputState;pub use services::SYSTEM_LOG_OWNER;pub use services::SystemSpan;
Modules§
- extension
Extensionregistration for the logging subsystem: schema, priority, required flag.- layer
tracingsubscriber layer that persists events to the database.- models
- Logging domain types: entries, levels, filters, and errors.
- repository
- Log persistence repository.
- runtime
- Owned handles to the logging pipeline.
- sanitize
- Shared field-value sanitization for the console and database log sinks.
- services
- Logging services: the
tracingwrite path and span helpers.