Skip to content

Conversation

@PythonGermany
Copy link
Contributor

Summary

Closes #1185

Checklist

  • Tested and/or added tests to validate that the changes work as intended, if applicable.
  • Updated documentation in README.md, if applicable.

@github-actions github-actions bot added the feature New feature or request label Dec 24, 2025
}
}
logr.Debugf("[security.callbackHandler] Subject %s is not in the list of allowed subjects", idToken.Subject)
slog.Debug("Subject not in allow-list", "subject", idToken.Subject)
Copy link
Contributor Author

@PythonGermany PythonGermany Dec 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Improve debug message to give more context -> What allow-list?

}
s.suiteCache.Set(suiteKey, status)
logr.Debugf("[memory.InsertSuiteResult] Stored suite result for suiteKey=%s, total results=%d", suiteKey, len(status.Results))
slog.Debug("Stored suite result", "key", suiteKey, "total_results", len(status.Results))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Improve message?

parsedDuration, err := time.ParseDuration(c.Query("duration"))
if err != nil {
logr.Errorf("[api.CreateExternalEndpointResult] Invalid duration from string=%s with error: %s", c.Query("duration"), err.Error())
slog.Error("Invalid duration", "duration", c.Query("duration"), "error", err.Error())
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: More message context needed?

return c.Status(500).SendString(err.Error())
}
logr.Infof("[api.CreateExternalEndpointResult] Successfully inserted result for external endpoint with key=%s and success=%s", c.Params("key"), success)
slog.Info("Successfully inserted result for external endpoint", slog.Group("result", "key", c.Params("key"), "success", success))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: Remove group test or apply in other places too?

"INFO": slog.LevelInfo,
"WARN": slog.LevelWarn,
"ERROR": slog.LevelError,
"FATAL": slog.LevelError, // slog does not have Fatal level, using Error instead TODO#1185: Check feasibility adding custom level FATAL to log handler or deprecate since its only used twice?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it ok that fatal log level does not exist anymore? I checked and it is possible to add custom levels, but it would obviously be convenient if we could just use the default ones.

Comment on lines 43 to 50
switch logSourceAsString {
case "", "FALSE":
break
case "TRUE":
logHandlerOptions.AddSource = true
default:
slog.Warn("Invalid log source value, defaulting to false", "provided", logSourceAsString)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this approach to disable source location logging by default and only enable different levels of verbosity for it via the GATUS_LOG_SOURCE and GATUS_LOG_TYPE env vars?

if !initialized {
// This only happens in tests
logr.Info("[store.Get] Provider requested before it was initialized, automatically initializing")
slog.Info("Provider requested before it was initialized, automatically initializing") // TODO#1185 Why was/is this not warn level?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not warn level?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Switch to Go's new built-in slog for logging

1 participant