mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-27 15:16:35 +00:00
@@ -125,7 +125,8 @@ func run(ctx context.Context, args []string) int {
|
|||||||
// Initialize collectors before loading and parsing CLI arguments
|
// Initialize collectors before loading and parsing CLI arguments
|
||||||
collectors := collector.NewWithFlags(app)
|
collectors := collector.NewWithFlags(app)
|
||||||
|
|
||||||
if err := config.Parse(app, os.Args[1:]); err != nil {
|
//nolint:contextcheck
|
||||||
|
if err := config.Parse(app, args); err != nil {
|
||||||
//nolint:sloglint // we do not have an logger yet
|
//nolint:sloglint // we do not have an logger yet
|
||||||
slog.LogAttrs(ctx, slog.LevelError, "Failed to load configuration",
|
slog.LogAttrs(ctx, slog.LevelError, "Failed to load configuration",
|
||||||
slog.Any("err", err),
|
slog.Any("err", err),
|
||||||
@@ -135,11 +136,13 @@ func run(ctx context.Context, args []string) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
debug.SetMemoryLimit(*memoryLimit)
|
debug.SetMemoryLimit(*memoryLimit)
|
||||||
|
|
||||||
logger, err := log.New(logConfig)
|
logger, err := log.New(logConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.LogAttrs(ctx, slog.LevelError, "failed to create logger",
|
logger.LogAttrs(ctx, slog.LevelError, "failed to create logger",
|
||||||
slog.Any("err", err),
|
slog.Any("err", err),
|
||||||
)
|
)
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user