80 lines
3.6 KiB
Rust
80 lines
3.6 KiB
Rust
// file: crates/ksp-logging-lib/src/lib.rs
|
|
// version: 9
|
|
|
|
#![warn(missing_docs)]
|
|
#![deny(unreachable_pub)]
|
|
#![forbid(unsafe_code)]
|
|
|
|
//! KSP-owned logging and tracing facade.
|
|
//!
|
|
//! This crate owns the KSP runtime logging contract. Behavioral KSP crates emit events and spans through this facade rather than depending directly on the
|
|
//! `tracing` stack. The crate owns the single global subscriber, KSP takeover filtering, transactional hot reload, non-blocking outputs, structured
|
|
//! level/target/domain routing and optional per-launch identities used to isolate persistent file outputs. Structured `domain` routing remains distinct from
|
|
//! targets and follows explicit event domains or inherited span domains.
|
|
|
|
mod domain;
|
|
mod error;
|
|
mod identity;
|
|
mod macros;
|
|
mod runtime;
|
|
mod settings;
|
|
mod span;
|
|
mod writer;
|
|
|
|
/// Error code used when a global logging subscriber is already installed.
|
|
pub use self::error::ERROR_CODE_ALREADY_INITIALIZED;
|
|
/// Error code used when the rolling file output cannot be initialized.
|
|
pub use self::error::ERROR_CODE_FILE_OUTPUT_INITIALIZATION_FAILED;
|
|
/// Error code used when an application Logging runtime identity is invalid.
|
|
pub use self::error::ERROR_CODE_INVALID_RUNTIME_IDENTITY;
|
|
/// Error code used when runtime logging settings are invalid.
|
|
pub use self::error::ERROR_CODE_INVALID_SETTINGS;
|
|
/// Error code used when a hot reload cannot replace the active runtime layers.
|
|
pub use self::error::ERROR_CODE_RELOAD_FAILED;
|
|
/// Stable application/launch identity used to isolate persistent Logging file outputs.
|
|
pub use self::identity::LoggingRuntimeIdentity;
|
|
/// Cumulative number of log lines dropped by non-blocking KSP outputs.
|
|
pub use self::runtime::DroppedLines;
|
|
/// Guard owning the mutable runtime state and non-blocking writers of the installed KSP logging subscriber.
|
|
pub use self::runtime::LoggingGuard;
|
|
/// Metadata for one active persistent Logging file output.
|
|
pub use self::runtime::RuntimeFileMetadata;
|
|
/// Installs the global KSP tracing subscriber.
|
|
pub use self::runtime::initialize;
|
|
/// Installs the global KSP tracing subscriber with a stable per-launch runtime identity.
|
|
pub use self::runtime::initialize_with_identity;
|
|
/// Replaces the active KSP logging settings without reinstalling the global subscriber.
|
|
pub use self::runtime::reinitialize;
|
|
/// Console stream selected for human-readable logs.
|
|
pub use self::settings::ConsoleOutput;
|
|
/// Runtime settings for the optional console output.
|
|
pub use self::settings::ConsoleSettings;
|
|
/// Rotation cadence for one file output.
|
|
pub use self::settings::FileRotation;
|
|
/// Runtime settings for one file output.
|
|
pub use self::settings::FileSettings;
|
|
/// Runtime filter level used by KSP logging settings.
|
|
pub use self::settings::LogFilterLevel;
|
|
/// Output format requested for one Logging sink.
|
|
pub use self::settings::LogFormat;
|
|
/// Complete runtime settings consumed by Logging initialization and reload.
|
|
pub use self::settings::LoggingSettings;
|
|
/// Per-output routing filter applied in addition to the global KSP takeover policy.
|
|
pub use self::settings::OutputFilter;
|
|
/// Lifecycle events emitted for spans by the formatted subscriber.
|
|
pub use self::settings::SpanEvents;
|
|
/// Per-target filter override owned by Logging.
|
|
pub use self::settings::TargetFilter;
|
|
/// KSP-owned handle to a tracing span.
|
|
pub use self::span::Span;
|
|
/// Instruments an asynchronous future with a KSP span.
|
|
pub use self::span::instrument;
|
|
|
|
pub(crate) use self::domain::current_domain_matches;
|
|
pub(crate) use self::writer::RoutedWriter;
|
|
pub(crate) use self::writer::StripAnsiWriter;
|
|
|
|
#[doc(hidden)]
|
|
/// Internal macro bridge. KSP consumers must not use this reexport directly.
|
|
pub extern crate tracing as __private_tracing;
|