Skip to content

Commit ece8630

Browse files
committed
Improve logging: handle trace level, default to info
1 parent 7b25bed commit ece8630

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cmd/root.go

+11-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,17 @@ func setupLogger(atmosConfig *schema.AtmosConfiguration) {
126126
//nolint:all // The reason to escape this is because it is expected to fail fast. The reason for ignoring all is because we also get a lint error to execute defer logFile.Close() before this but that is not required
127127
log.Fatal(err)
128128
}
129-
log.Debug("Set", "logs-level", log.GetLevel(), "logs-file", atmosConfig.Logs.File)
129+
// Use the log level from config directly for consistent output
130+
logLevelStr := strings.ToLower(atmosConfig.Logs.Level)
131+
if logLevelStr == "" {
132+
logLevelStr = "info" // Default value if not specified
133+
}
134+
135+
if strings.ToLower(atmosConfig.Logs.Level) == "trace" {
136+
log.Log(logger.AtmosTraceLevel, "Set", "logs-level", logLevelStr, "logs-file", atmosConfig.Logs.File)
137+
} else {
138+
log.Debug("Set", "logs-level", logLevelStr, "logs-file", atmosConfig.Logs.File)
139+
}
130140
}
131141

132142
// Execute adds all child commands to the root command and sets flags appropriately.

0 commit comments

Comments
 (0)