🐛 fix: emit all config-loading logs in correct format from the start
The logger was initialised to console format unconditionally, so the "Config file loaded" message (and similar early logs) were always written as human-readable text even when JSON logging was configured. Root cause: classic chicken-and-egg — the format flag lives inside the config that is being loaded. Fix: add peekJSONLogging() which resolves the format before any log is emitted by (1) checking DLC_LOGGING_JSON directly via os.Getenv, then (2) doing a minimal throwaway Viper pre-read of the config file for the logging.json key. The redundant format-switch block that ran after Unmarshal() is removed. Also add the "Logging configured" log as the very first line, and replace the hardcoded PROJECT_DIR path in start-server.sh, test-graceful-shutdown.sh, and test-opentelemetry.sh with a dynamic derivation from BASH_SOURCE[0]. Closes #15 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,8 @@
|
||||
set -e
|
||||
|
||||
# Configuration
|
||||
PROJECT_DIR="/Users/gabrielradureau/Work/Vibe/dance-lessons-coach"
|
||||
SCRIPTS_DIR=$(dirname "$(realpath "${BASH_SOURCE[0]}")")
|
||||
PROJECT_DIR=$(dirname "$SCRIPTS_DIR")
|
||||
SERVER_CMD="./scripts/start-server.sh"
|
||||
LOG_FILE="server.log"
|
||||
PID_FILE="server.pid"
|
||||
|
||||
Reference in New Issue
Block a user