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 /docs/reference | |
| 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 'docs/reference')
| -rw-r--r-- | docs/reference/configuration.md | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/docs/reference/configuration.md b/docs/reference/configuration.md index b24b498..b09b20f 100644 --- a/docs/reference/configuration.md +++ b/docs/reference/configuration.md | |||
| @@ -1041,10 +1041,10 @@ Per-connection limits (built-in to relay-builder, not configurable): | |||
| 1041 | 1041 | ||
| 1042 | ### Logging Configuration | 1042 | ### Logging Configuration |
| 1043 | 1043 | ||
| 1044 | #### `RUST_LOG` | 1044 | #### `NGIT_LOG_LEVEL` |
| 1045 | 1045 | ||
| 1046 | **Description:** Logging level and filters (standard Rust environment variable) | 1046 | **Description:** Logging level and filters for application logging |
| 1047 | **Type:** String (log level or filter) | 1047 | **Type:** String (log level or filter expression) |
| 1048 | **Default:** `info` | 1048 | **Default:** `info` |
| 1049 | **Required:** No | 1049 | **Required:** No |
| 1050 | 1050 | ||
| @@ -1052,17 +1052,17 @@ Per-connection limits (built-in to relay-builder, not configurable): | |||
| 1052 | 1052 | ||
| 1053 | ```bash | 1053 | ```bash |
| 1054 | # Simple levels | 1054 | # Simple levels |
| 1055 | RUST_LOG=error # Errors only | 1055 | NGIT_LOG_LEVEL=error # Errors only |
| 1056 | RUST_LOG=warn # Warnings and errors | 1056 | NGIT_LOG_LEVEL=warn # Warnings and errors |
| 1057 | RUST_LOG=info # Info, warnings, errors | 1057 | NGIT_LOG_LEVEL=info # Info, warnings, errors (default) |
| 1058 | RUST_LOG=debug # Debug and above | 1058 | NGIT_LOG_LEVEL=debug # Debug and above |
| 1059 | RUST_LOG=trace # Everything | 1059 | NGIT_LOG_LEVEL=trace # Everything (very verbose) |
| 1060 | 1060 | ||
| 1061 | # Module-specific | 1061 | # Module-specific filtering |
| 1062 | RUST_LOG=ngit_grasp=debug,actix_web=info | 1062 | NGIT_LOG_LEVEL=ngit_grasp=debug,actix_web=info |
| 1063 | 1063 | ||
| 1064 | # Complex filters | 1064 | # Complex filters |
| 1065 | RUST_LOG=debug,hyper=info,tokio=warn | 1065 | NGIT_LOG_LEVEL=debug,hyper=info,tokio=warn |
| 1066 | ``` | 1066 | ``` |
| 1067 | 1067 | ||
| 1068 | **Log levels (most to least verbose):** | 1068 | **Log levels (most to least verbose):** |
| @@ -1073,12 +1073,25 @@ RUST_LOG=debug,hyper=info,tokio=warn | |||
| 1073 | 4. `warn` - Warnings about potential issues | 1073 | 4. `warn` - Warnings about potential issues |
| 1074 | 5. `error` - Errors only | 1074 | 5. `error` - Errors only |
| 1075 | 1075 | ||
| 1076 | **CLI flag:** | ||
| 1077 | |||
| 1078 | ```bash | ||
| 1079 | ngit-grasp --log-level trace | ||
| 1080 | ``` | ||
| 1081 | |||
| 1076 | **Production recommendation:** | 1082 | **Production recommendation:** |
| 1077 | 1083 | ||
| 1078 | ```bash | 1084 | ```bash |
| 1079 | RUST_LOG=info,ngit_grasp=debug | 1085 | NGIT_LOG_LEVEL=info |
| 1080 | ``` | 1086 | ``` |
| 1081 | 1087 | ||
| 1088 | **Notes:** | ||
| 1089 | |||
| 1090 | - Uses Rust's `tracing` crate filter syntax | ||
| 1091 | - Supports module-level filtering (e.g., `ngit_grasp=debug,hyper=info`) | ||
| 1092 | - `trace` level can significantly impact performance | ||
| 1093 | - For production, `info` or `warn` is recommended | ||
| 1094 | |||
| 1082 | --- | 1095 | --- |
| 1083 | 1096 | ||
| 1084 | ### Security Configuration (Planned) | 1097 | ### Security Configuration (Planned) |