K8s: standalone: use Grafana's logger to stream all logs (#84530)

---
Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
This commit is contained in:
Charandas
2024-03-18 19:25:30 +02:00
committed by GitHub
co-authored by Marcus Efraimsson
parent 3ea5c08c88
commit 2d1cd82a98
4 changed files with 79 additions and 20 deletions
+31
View File
@@ -499,3 +499,34 @@ func ReadLoggingConfig(modes []string, logsPath string, cfg *ini.File) error {
return nil
}
// SetupConsoleLogger setup Grafana console logger with provided level.
func SetupConsoleLogger(level string) error {
iniFile := ini.Empty()
sLog, err := iniFile.NewSection("log")
if err != nil {
return err
}
_, err = sLog.NewKey("level", level)
if err != nil {
return err
}
sLogConsole, err := iniFile.NewSection("log.console")
if err != nil {
return err
}
_, err = sLogConsole.NewKey("format", "console")
if err != nil {
return err
}
err = ReadLoggingConfig([]string{"console"}, "", iniFile)
if err != nil {
return err
}
return nil
}