Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/loki: minor consistency patch #6364

Merged
merged 2 commits into from
Jun 10, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions cmd/loki/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,19 @@ func main() {

// Validate the config once both the config file has been loaded
// and CLI flags parsed.
err := config.Validate()
if err != nil {
if err := config.Validate(); err != nil {
level.Error(util_log.Logger).Log("msg", "validating config", "err", err.Error())
os.Exit(1)
}

if config.PrintConfig {
err := util.PrintConfig(os.Stderr, &config)
if err != nil {
if err := util.PrintConfig(os.Stderr, &config); err != nil {
level.Error(util_log.Logger).Log("msg", "failed to print config to stderr", "err", err.Error())
}
}

if config.LogConfig {
err := util.LogConfig(&config)
if err != nil {
if err := util.LogConfig(&config); err != nil {
level.Error(util_log.Logger).Log("msg", "failed to log config object", "err", err.Error())
}
}
Expand All @@ -78,13 +75,13 @@ func main() {
if err != nil {
level.Error(util_log.Logger).Log("msg", "error in initializing tracing. tracing will not be enabled", "err", err)
}

defer func() {
if trace != nil {
if err := trace.Close(); err != nil {
level.Error(util_log.Logger).Log("msg", "error closing tracing", "err", err)
}
}

}()
}

Expand Down