mirror of
https://codeberg.org/git-pages/git-pages.git
synced 2026-05-14 11:11:35 +00:00
Allow configuring log format.
In a production environment the timestamp will be appended by the log service.
This commit is contained in:
@@ -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"`
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user