mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-12 17:33:09 -06:00
Add logs-related parameters to the configuration
Signed-off-by: Tristan Claverie <public@tclaverie.eu>
This commit is contained in:
parent
b835e585c4
commit
ae4992fa83
|
|
@ -117,6 +117,13 @@ listen:
|
||||||
tracing:
|
tracing:
|
||||||
# Config for the jaeger opentracing reporter.
|
# Config for the jaeger opentracing reporter.
|
||||||
# See https://godoc.org/github.com/uber/jaeger-client-go/config#Configuration
|
# See https://godoc.org/github.com/uber/jaeger-client-go/config#Configuration
|
||||||
# for documtation.
|
# for documentation.
|
||||||
jaeger:
|
jaeger:
|
||||||
disabled: true
|
disabled: true
|
||||||
|
|
||||||
|
# The configuration for logs of dendrite
|
||||||
|
logging:
|
||||||
|
# The logging level, must be one of debug, info, warn, error, fatal, panic.
|
||||||
|
level: "info"
|
||||||
|
# The file on which save logs. If commented, logs won't be saved by dendrite and only printed to stdout
|
||||||
|
# path: /var/log/dendrite.log
|
||||||
|
|
|
||||||
|
|
@ -206,6 +206,15 @@ type Dendrite struct {
|
||||||
Jaeger jaegerconfig.Configuration `yaml:"jaeger"`
|
Jaeger jaegerconfig.Configuration `yaml:"jaeger"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The config for logging informations
|
||||||
|
Logging struct {
|
||||||
|
// The path to the log file
|
||||||
|
FPath Path `yaml:"path"`
|
||||||
|
|
||||||
|
// The logging level
|
||||||
|
Level string `yaml:"level"`
|
||||||
|
} `yaml:"logging"`
|
||||||
|
|
||||||
// Any information derived from the configuration options for later use.
|
// Any information derived from the configuration options for later use.
|
||||||
Derived struct {
|
Derived struct {
|
||||||
Registration struct {
|
Registration struct {
|
||||||
|
|
@ -219,6 +228,9 @@ type Dendrite struct {
|
||||||
// registration in order to complete registration stages.
|
// registration in order to complete registration stages.
|
||||||
Params map[string]interface{} `json:"params"`
|
Params map[string]interface{} `json:"params"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The logrus level used for logging configuration
|
||||||
|
LogLevel logrus.Level
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -472,6 +484,12 @@ func (config *Dendrite) check(monolithic bool) error {
|
||||||
checkNotEmpty("listen.room_server", string(config.Listen.RoomServer))
|
checkNotEmpty("listen.room_server", string(config.Listen.RoomServer))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if level, err := logrus.ParseLevel(config.Logging.Level); err != nil {
|
||||||
|
problems = append(problems, fmt.Sprintf("Invalid value for key logging.level: %s", config.Logging.Level))
|
||||||
|
} else {
|
||||||
|
config.Derived.LogLevel = level
|
||||||
|
}
|
||||||
|
|
||||||
if problems != nil {
|
if problems != nil {
|
||||||
return Error{problems}
|
return Error{problems}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,9 @@ listen:
|
||||||
federation_api: "localhost:7772"
|
federation_api: "localhost:7772"
|
||||||
sync_api: "localhost:7773"
|
sync_api: "localhost:7773"
|
||||||
media_api: "localhost:7774"
|
media_api: "localhost:7774"
|
||||||
|
logging:
|
||||||
|
level: "debug"
|
||||||
|
path: "/my/log/dir/dendrite.log"
|
||||||
`
|
`
|
||||||
|
|
||||||
type mockReadFile map[string]string
|
type mockReadFile map[string]string
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue