diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-26 16:17:55 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-27 20:38:15 +0000 |
| commit | 1ae97cd85aec95f6270f853b28e48774cefc6bf6 (patch) | |
| tree | b03bb341682e3c8ac69a482e370914e4a0060a85 /nix | |
| parent | 87bd544b4539fc17c7919a2185663fb9debae2d1 (diff) | |
feat: add NGIT_LOG_LEVEL configuration option
Add proper log level configuration following standard approach:
- CLI flag: --log-level <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.
Diffstat (limited to 'nix')
| -rw-r--r-- | nix/module.nix | 11 |
1 files changed, 8 insertions, 3 deletions
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 | |||
| 127 | }; | 127 | }; |
| 128 | 128 | ||
| 129 | logLevel = mkOption { | 129 | logLevel = mkOption { |
| 130 | type = types.enum [ "trace" "debug" "info" "warn" "error" ]; | 130 | type = types.str; |
| 131 | default = "info"; | 131 | default = "info"; |
| 132 | description = "Logging level for RUST_LOG environment variable"; | 132 | example = "debug"; |
| 133 | description = '' | ||
| 134 | Logging level for application logging. | ||
| 135 | Can be a simple level (trace, debug, info, warn, error) or a filter expression. | ||
| 136 | Examples: "info", "debug", "ngit_grasp=debug,actix_web=info" | ||
| 137 | ''; | ||
| 133 | }; | 138 | }; |
| 134 | 139 | ||
| 135 | syncMaxBackoffSecs = mkOption { | 140 | syncMaxBackoffSecs = mkOption { |
| @@ -334,7 +339,7 @@ let | |||
| 334 | NGIT_REPOSITORY_BLACKLIST = concatStringsSep "," cfg.repositoryBlacklist; | 339 | NGIT_REPOSITORY_BLACKLIST = concatStringsSep "," cfg.repositoryBlacklist; |
| 335 | NGIT_EVENT_BLACKLIST = concatStringsSep "," cfg.eventBlacklist; | 340 | NGIT_EVENT_BLACKLIST = concatStringsSep "," cfg.eventBlacklist; |
| 336 | NGIT_MAX_CONNECTIONS = toString cfg.maxConnections; | 341 | NGIT_MAX_CONNECTIONS = toString cfg.maxConnections; |
| 337 | RUST_LOG = cfg.logLevel; | 342 | NGIT_LOG_LEVEL = cfg.logLevel; |
| 338 | } // optionalAttrs (cfg.relayName != null) { | 343 | } // optionalAttrs (cfg.relayName != null) { |
| 339 | NGIT_RELAY_NAME = cfg.relayName; | 344 | NGIT_RELAY_NAME = cfg.relayName; |
| 340 | } // optionalAttrs (cfg.archiveReadOnly != null) { | 345 | } // optionalAttrs (cfg.archiveReadOnly != null) { |