From 025df3490c6470c21cdff42c50e7bcf1742a9b45 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 1 Dec 2025 12:59:30 +0900 Subject: [PATCH] server: add prelude print --- src/core/common.rs | 11 +++++++++++ src/server/command.rs | 21 ++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/core/common.rs b/src/core/common.rs index af406b1..fae8d99 100644 --- a/src/core/common.rs +++ b/src/core/common.rs @@ -1,4 +1,5 @@ use anyhow::Context; +use indoc::indoc; use nix::unistd::{Group as LibcGroup, User as LibcUser}; #[cfg(not(target_os = "macos"))] @@ -7,6 +8,16 @@ use std::ffi::CString; pub const DEFAULT_CONFIG_PATH: &str = "/etc/muscl/config.toml"; pub const DEFAULT_SOCKET_PATH: &str = "/run/muscl/muscl.sock"; +pub const ASCII_BANNER: &str = indoc! { + r#" + __ + ____ ___ __ ____________/ / + / __ `__ \/ / / / ___/ ___/ / + / / / / / / /_/ (__ ) /__/ / + /_/ /_/ /_/\__,_/____/\___/_/ + "# +}; + #[derive(Debug, Clone)] pub struct UnixUser { pub username: String, diff --git a/src/server/command.rs b/src/server/command.rs index 6a0ae9d..c515a2d 100644 --- a/src/server/command.rs +++ b/src/server/command.rs @@ -5,7 +5,10 @@ use clap::Parser; use clap_verbosity_flag::Verbosity; use tracing_subscriber::prelude::*; -use crate::{core::common::DEFAULT_CONFIG_PATH, server::supervisor::Supervisor}; +use crate::{ + core::common::{ASCII_BANNER, DEFAULT_CONFIG_PATH}, + server::supervisor::Supervisor, +}; #[derive(Parser, Debug, Clone)] pub struct ServerArgs { @@ -46,6 +49,18 @@ const LOG_LEVEL_WARNING: &str = r#" =================================================== "#; +pub fn trace_server_prelude() { + let message = [ + ASCII_BANNER, + "", + "Hacked together by yours truly, Programvareverkstedet ", + "If you experience any bugs or turbulence, please give us a heads up :)", + "", + ] + .join("\n"); + tracing::info!(message); +} + pub async fn handle_command( config_path: Option, verbosity: Verbosity, @@ -69,6 +84,8 @@ pub async fn handle_command( tracing::subscriber::set_global_default(subscriber) .context("Failed to set global default tracing subscriber")?; + trace_server_prelude(); + if verbosity.tracing_level_filter() >= tracing::Level::TRACE { tracing::warn!("{}", LOG_LEVEL_WARNING.trim()); } @@ -92,6 +109,8 @@ pub async fn handle_command( tracing::subscriber::set_global_default(subscriber) .context("Failed to set global default tracing subscriber")?; + trace_server_prelude(); + tracing::info!("Running in standalone mode"); }