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

31
Cargo.lock generated
View File

@@ -999,6 +999,17 @@ name = "interner"
version = "0.2.1"
source = "git+https://github.com/c2vi/interner#746e7586bb65e2e50ac02140c6414574efb2eb4e"
[[package]]
name = "io-uring"
version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b86e202f00093dcba4275d4636b93ef9dd75d025ae560d2521b45ea28ab49013"
dependencies = [
"bitflags 2.5.0",
"cfg-if 1.0.0",
"libc",
]
[[package]]
name = "is_terminal_polyfill"
version = "1.70.0"
@@ -1035,9 +1046,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67"
[[package]]
name = "libc"
version = "0.2.155"
version = "0.2.174"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776"
[[package]]
name = "libloading"
@@ -1134,13 +1145,14 @@ dependencies = [
[[package]]
name = "mio"
version = "0.8.11"
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c"
checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec"
dependencies = [
"hermit-abi",
"libc",
"wasi",
"windows-sys 0.48.0",
"windows-sys 0.52.0",
]
[[package]]
@@ -2013,18 +2025,19 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
version = "1.38.0"
version = "1.46.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a"
checksum = "0cc3a2344dafbe23a245241fe8b09735b521110d30fcefbbd5feb1797ca35d17"
dependencies = [
"backtrace",
"bytes",
"io-uring",
"libc",
"mio",
"num_cpus",
"pin-project-lite",
"slab",
"socket2",
"windows-sys 0.48.0",
"windows-sys 0.52.0",
]
[[package]]

View File

@@ -59,7 +59,7 @@ daemonize = { version = "0.5.0", optional = true }
nix = { version = "0.27.1", features = ["signal"], optional = true }
sysinfo = { version = "0.30.12", optional = true }
tracing-subscriber = { version = "0.3.18", optional = true }
tokio = { version = "1.21.0", features = ["sync"], optional = true }
tokio = { version = "1.46.1", features = ["sync"], optional = true }
libloading = { version = "0.8.5", optional = true }
ciborium-io = { version = "0.2.2", optional = true }
tracing-core = { version = "0.1.32", optional = true }

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;