From 1ae97cd85aec95f6270f853b28e48774cefc6bf6 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Mon, 26 Jan 2026 16:17:55 +0000 Subject: feat: add NGIT_LOG_LEVEL configuration option Add proper log level configuration following standard approach: - CLI flag: --log-level - Environment variable: NGIT_LOG_LEVEL - Default: info - Supports simple levels (error, warn, info, debug, trace) - Supports filter expressions (e.g., ngit_grasp=debug,actix_web=info) Configuration is now consistent across all four sources: 1. src/config.rs - Config struct with log_level field 2. docs/reference/configuration.md - Full documentation 3. nix/module.nix - NixOS module with logLevel option 4. .env.example - Example configuration file This replaces the previous RUST_LOG approach with proper integration into the ngit-grasp configuration system, enabling trace logging from CLI, environment variables, or NixOS configuration. --- nix/module.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'nix/module.nix') diff --git a/nix/module.nix b/nix/module.nix index 4a6fc94..89d58de 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -127,9 +127,14 @@ let }; logLevel = mkOption { - type = types.enum [ "trace" "debug" "info" "warn" "error" ]; + type = types.str; default = "info"; - description = "Logging level for RUST_LOG environment variable"; + example = "debug"; + description = '' + Logging level for application logging. + Can be a simple level (trace, debug, info, warn, error) or a filter expression. + Examples: "info", "debug", "ngit_grasp=debug,actix_web=info" + ''; }; syncMaxBackoffSecs = mkOption { @@ -334,7 +339,7 @@ let NGIT_REPOSITORY_BLACKLIST = concatStringsSep "," cfg.repositoryBlacklist; NGIT_EVENT_BLACKLIST = concatStringsSep "," cfg.eventBlacklist; NGIT_MAX_CONNECTIONS = toString cfg.maxConnections; - RUST_LOG = cfg.logLevel; + NGIT_LOG_LEVEL = cfg.logLevel; } // optionalAttrs (cfg.relayName != null) { NGIT_RELAY_NAME = cfg.relayName; } // optionalAttrs (cfg.archiveReadOnly != null) { -- cgit v1.2.3