some logging changes

This commit is contained in:
Sebastian Moser
2026-02-01 10:59:22 +01:00
parent 85878f5707
commit 2a76a3f14b
7 changed files with 33 additions and 23 deletions

View File

@@ -554,7 +554,7 @@ impl Instance {
#[cfg(feature = "async")]
pub fn spawn_async<F: Future<Output = impl Send + Sync + 'static> + Send + Sync + 'static>(&mut self, name: &str, func: F) -> MizeResult<()> {
pub fn spawn_async<F: Future<Output = impl Send + 'static> + Send + 'static>(&mut self, name: &str, func: F) -> MizeResult<()> {
let mut threads_inner = self.threads.lock()?;
let mut next_thread_id = self.next_thread_id.lock()?;

View File

@@ -2,7 +2,6 @@ use std::fs;
use std::path::{Path, PathBuf};
use std::fs::OpenOptions;
use sysinfo::{System, Pid, ProcessRefreshKind, RefreshKind};
use tracing::field::debug;
use std::io::Write;
use ciborium::Value as CborValue;
use tracing::debug;

View File

@@ -3,9 +3,6 @@ use std::path::PathBuf;
use clap::{ArgAction, ArgMatches};
use clap::{Arg, crate_version, Command};
use mize::error::{MizeError, MizeResult};
use mize::id::MizeId;
use mize::item::ItemData;
use tokio::sync::mpsc;
use std::sync::Mutex;
use std::sync::Arc;
@@ -22,17 +19,19 @@ use tracing_subscriber::fmt::format;
use tracing::Event;
use core::fmt;
use tracing_subscriber::fmt::FormattedFields;
use tracing::{trace, debug, info, warn, error};
use crate::DEFAULT_LOG_LEVEL;
use std::sync::atomic::AtomicUsize;
use tracing::{field::Visit, Id, Subscriber};
use tracing_core::Field;
use std::fmt::Write;
use crate::MizeError;
use crate::MizeResult;
use crate::id::MizeId;
use crate::item::ItemData;
static DEFAULT_LOG_LEVEL: LevelFilter = LevelFilter::WARN;
pub fn init_logger(cli_matches: &ArgMatches) {
// to save log messages, before the logger is setup

View File

@@ -20,15 +20,13 @@ use tracing_subscriber::fmt::Subscriber;
use tracing::Level;
use tracing::level_filters::LevelFilter;
use tracing_subscriber::filter::EnvFilter;
use crate::logging::init_logger;
use mize::platform::os::logging::init_logger;
use tracing::{trace, debug, info, warn, error};
mod cli;
mod logging;
static APPNAME: &str = "mize";
static DEFAULT_LOG_LEVEL: LevelFilter = LevelFilter::WARN;
fn main() {
// welcome to the mize source code

View File

@@ -24,6 +24,7 @@ use crate::instance::module::EmptyModule;
use self::fsstore::FileStore;
pub mod fsstore;
pub mod logging;
#[cfg(target_family = "unix")]
mod unix_socket;