mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-10-18 02:29:04 +02:00
log: add size-based log file rotation (#2682)
Signed-off-by: EisenbergD <dominik.eisenberg@beiersdorf.com> Co-authored-by: EisenbergD <dominik.eisenberg@beiersdorf.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
EisenbergD
Claude Opus 5.5
parent
6e242d7af2
commit
5a7f8b5bd3
@@ -175,13 +175,19 @@ func run(ctx context.Context, args []string) int {
|
||||
_ = logFile.Set("stderr")
|
||||
}
|
||||
|
||||
logger, err := log.New(logConfig)
|
||||
logger, logCloser, err := log.New(logConfig)
|
||||
if err != nil {
|
||||
logStartupError(ctx, "failed to create logger", err)
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
if logCloser != nil {
|
||||
defer func() {
|
||||
_ = logCloser.Close()
|
||||
}()
|
||||
}
|
||||
|
||||
logger.LogAttrs(ctx, slog.LevelDebug, "logging has Started")
|
||||
|
||||
if configFile != nil && *configFile != "" {
|
||||
|
||||
Reference in New Issue
Block a user