log.go

 1package config
 2
 3import "time"
 4
 5// Log is the logger configuration.
 6var Log = &LogConfig{
 7	Format:     "text",
 8	TimeFormat: time.DateTime,
 9}
10
11// LogConfig is the logger configuration.
12type LogConfig struct {
13	// Format is the format of the logs.
14	// Valid values are "json", "logfmt", and "text".
15	Format string `env:"FORMAT" yaml:"format"`
16
17	// Time format for the log `ts` field.
18	// Format must be described in Golang's time format.
19	TimeFormat string `env:"TIME_FORMAT" yaml:"time_format"`
20}
21
22// Environ returns the environment variables for the config.
23func (l LogConfig) Environ() []string {
24	return []string{
25		"SOFT_SERVE_LOG_FORMAT=" + l.Format,
26		"SOFT_SERVE_LOG_TIME_FORMAT=" + l.TimeFormat,
27	}
28}