Allow configuring log format.

In a production environment the timestamp will be appended by the log
service.
This commit is contained in:
Catherine
2025-09-18 02:00:48 +00:00
parent bd6e377e43
commit fb9f4a7c4a
2 changed files with 9 additions and 1 deletions

View File

@@ -12,7 +12,8 @@ type CacheConfig struct {
}
type Config struct {
Listen struct {
LogFormat string `toml:"log-format"`
Listen struct {
Pages string `toml:"pages"`
Caddy string `toml:"caddy"`
Health string `toml:"health"`

View File

@@ -41,6 +41,13 @@ func main() {
}
UpdateConfigEnv() // environment takes priority
switch config.LogFormat {
case "short":
log.SetFlags(0)
default:
log.SetFlags(log.Ldate | log.Ltime | log.LUTC)
}
switch config.Backend.Type {
case "fs":
if backend, err = NewFSBackend(config.Backend.FS.Root); err != nil {