systemprompt-logging 0.65.0

Tracing and audit infrastructure for systemprompt.io AI governance. Structured events, five-point audit traces, and SIEM-ready JSON output — part of the MCP governance pipeline.
Documentation
//! Display primitives for CLI output.
//!
//! Defines the [`Display`] trait and the levelled-message and section-header
//! helpers. All output goes to stderr via this sanctioned
//! display sink.
//!
//! Copyright (c) systemprompt.io — Business Source License 1.1.
//! See <https://systemprompt.io> for licensing details.

use crate::services::cli::sink::stderr_writeln;
use crate::services::cli::theme::{EmphasisType, MessageLevel, Theme};

pub trait Display {
    fn display(&self);
}

const fn message_level_str(level: MessageLevel) -> &'static str {
    match level {
        MessageLevel::Success => "success",
        MessageLevel::Warning => "warning",
        MessageLevel::Error => "error",
        MessageLevel::Info => "info",
    }
}

pub fn message(level: MessageLevel, text: &str) {
    if crate::services::output::is_structured_output() {
        crate::services::output::buffer_notice(message_level_str(level), text);
        return;
    }
    stderr_writeln(format_args!(
        "{} {}",
        Theme::icon(level),
        Theme::color(text, level)
    ));
}

pub fn section_header(title: &str) {
    stderr_writeln(format_args!(
        "\n{}",
        Theme::color(title, EmphasisType::Underlined)
    ));
}

pub fn subsection_header(title: &str) {
    stderr_writeln(format_args!(
        "\n  {}",
        Theme::color(title, EmphasisType::Bold)
    ));
}