Fix verbosity flag and default logging level
Some checks failed
Some checks failed
This commit is contained in:
@@ -16,16 +16,14 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
logLevel = lib.mkOption {
|
logLevel = lib.mkOption {
|
||||||
type = lib.types.enum [ "quiet" "error" "warn" "info" "debug" "trace" ];
|
type = lib.types.enum [ "quiet" "info" "debug" "trace" ];
|
||||||
default = "info";
|
default = "info";
|
||||||
description = "Log level for muscl";
|
description = "Log level for muscl";
|
||||||
apply = level: {
|
apply = level: {
|
||||||
"quiet" = "-q";
|
"quiet" = "-q";
|
||||||
"error" = "";
|
"info" = "";
|
||||||
"warn" = "-v";
|
"debug" = "-v";
|
||||||
"info" = "-vv";
|
"trace" = "-vv";
|
||||||
"debug" = "-vvv";
|
|
||||||
"trace" = "-vvvv";
|
|
||||||
}.${level};
|
}.${level};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
use std::{fs, path::PathBuf, sync::Arc, time::Duration};
|
use std::{fs, path::PathBuf, sync::Arc, time::Duration};
|
||||||
|
|
||||||
use anyhow::{Context, anyhow};
|
use anyhow::{Context, anyhow};
|
||||||
use clap_verbosity_flag::Verbosity;
|
use clap_verbosity_flag::{InfoLevel, Verbosity};
|
||||||
use nix::libc::{EXIT_SUCCESS, exit};
|
use nix::libc::{EXIT_SUCCESS, exit};
|
||||||
use sqlx::mysql::MySqlPoolOptions;
|
use sqlx::mysql::MySqlPoolOptions;
|
||||||
use std::os::unix::net::UnixStream as StdUnixStream;
|
use std::os::unix::net::UnixStream as StdUnixStream;
|
||||||
@@ -77,7 +77,7 @@ fn will_connect_to_external_server(
|
|||||||
pub fn bootstrap_server_connection_and_drop_privileges(
|
pub fn bootstrap_server_connection_and_drop_privileges(
|
||||||
server_socket_path: Option<PathBuf>,
|
server_socket_path: Option<PathBuf>,
|
||||||
config: Option<PathBuf>,
|
config: Option<PathBuf>,
|
||||||
verbose: Verbosity,
|
verbose: Verbosity<InfoLevel>,
|
||||||
) -> anyhow::Result<StdUnixStream> {
|
) -> anyhow::Result<StdUnixStream> {
|
||||||
if will_connect_to_external_server(server_socket_path.as_ref(), config.as_ref())? {
|
if will_connect_to_external_server(server_socket_path.as_ref(), config.as_ref())? {
|
||||||
assert!(
|
assert!(
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ extern crate prettytable;
|
|||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use clap::{CommandFactory, Parser, ValueEnum};
|
use clap::{CommandFactory, Parser, ValueEnum};
|
||||||
use clap_complete::{CompleteEnv, Shell, generate};
|
use clap_complete::{CompleteEnv, Shell, generate};
|
||||||
use clap_verbosity_flag::Verbosity;
|
use clap_verbosity_flag::{InfoLevel, Verbosity};
|
||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ struct Args {
|
|||||||
config: Option<PathBuf>,
|
config: Option<PathBuf>,
|
||||||
|
|
||||||
#[command(flatten)]
|
#[command(flatten)]
|
||||||
verbose: Verbosity,
|
verbose: Verbosity<InfoLevel>
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Parser, Debug, Clone)]
|
#[derive(Parser, Debug, Clone)]
|
||||||
@@ -252,7 +252,7 @@ const MIN_TOKIO_WORKER_THREADS: usize = 4;
|
|||||||
/// Start a long-lived server using Tokio.
|
/// Start a long-lived server using Tokio.
|
||||||
fn tokio_start_server(
|
fn tokio_start_server(
|
||||||
config_path: Option<PathBuf>,
|
config_path: Option<PathBuf>,
|
||||||
verbosity: Verbosity,
|
verbosity: Verbosity<InfoLevel>,
|
||||||
args: ServerArgs,
|
args: ServerArgs,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let worker_thread_count = std::cmp::max(num_cpus::get(), MIN_TOKIO_WORKER_THREADS);
|
let worker_thread_count = std::cmp::max(num_cpus::get(), MIN_TOKIO_WORKER_THREADS);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ use std::path::PathBuf;
|
|||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use clap_verbosity_flag::Verbosity;
|
use clap_verbosity_flag::{InfoLevel, Verbosity};
|
||||||
use tracing_subscriber::prelude::*;
|
use tracing_subscriber::prelude::*;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
@@ -56,7 +56,7 @@ pub fn trace_server_prelude() {
|
|||||||
|
|
||||||
pub async fn handle_command(
|
pub async fn handle_command(
|
||||||
config_path: Option<PathBuf>,
|
config_path: Option<PathBuf>,
|
||||||
verbosity: Verbosity,
|
verbosity: Verbosity<InfoLevel>,
|
||||||
args: ServerArgs,
|
args: ServerArgs,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let mut auto_detected_systemd_mode = false;
|
let mut auto_detected_systemd_mode = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user