mecha10-cli 0.1.47

Mecha10 CLI tool
Documentation
//! Logs command arguments

use clap::Args;

/// View logs from nodes, framework, and services
#[derive(Args, Debug)]
pub struct LogsArgs {
    /// Optional node name to filter logs (e.g., "camera_driver")
    #[arg(value_name = "NODE")]
    pub node: Option<String>,

    /// Follow logs in real-time (default behavior, use --no-follow to disable)
    #[arg(short, long, default_value = "true", action = clap::ArgAction::SetTrue)]
    pub follow: bool,

    /// Disable follow mode (show static logs)
    #[arg(long, conflicts_with = "follow")]
    pub no_follow: bool,

    /// Filter logs by pattern (case-insensitive substring match)
    #[arg(short = 'g', long, value_name = "PATTERN")]
    pub filter: Option<String>,

    /// Number of lines to show (tail behavior)
    #[arg(short = 'n', long, value_name = "LINES", default_value = "100")]
    pub lines: Option<usize>,

    /// Log source type to display
    #[arg(short = 's', long, value_name = "SOURCE", value_enum)]
    pub source: Option<LogSource>,

    /// Show timestamps
    #[arg(short = 't', long)]
    pub timestamps: bool,

    /// Log level filter (error, warn, info, debug, trace)
    #[arg(long, value_name = "LEVEL")]
    pub level: Option<String>,
}

/// Log source types
#[derive(Debug, Clone, Copy, PartialEq, Eq, clap::ValueEnum)]
pub enum LogSource {
    /// All log sources
    All,
    /// Node logs only
    Nodes,
    /// Framework/CLI logs
    Framework,
    /// Infrastructure services (Redis, PostgreSQL, etc.)
    Services,
}