mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-01 03:03:10 -06:00
Revert logging formatter changes to log.go, base.go.
The same formatting should be applied on both windows and unix, so it makes sense to keep it in files which are shared between both platforms. Fixes https://github.com/matrix-org/dendrite/pull/2060#discussion_r762557679
This commit is contained in:
parent
abd370a133
commit
f886fbc917
|
|
@ -91,6 +91,21 @@ func SetupPprof() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetupStdLogging configures the logging format to standard output. Typically, it is called when the config is not yet loaded.
|
||||||
|
func SetupStdLogging() {
|
||||||
|
logrus.SetReportCaller(true)
|
||||||
|
logrus.SetFormatter(&utcFormatter{
|
||||||
|
&logrus.TextFormatter{
|
||||||
|
TimestampFormat: "2006-01-02T15:04:05.000000000Z07:00",
|
||||||
|
FullTimestamp: true,
|
||||||
|
DisableColors: false,
|
||||||
|
DisableTimestamp: false,
|
||||||
|
QuoteEmptyFields: true,
|
||||||
|
CallerPrettyfier: callerPrettyfier,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// File type hooks should be provided a path to a directory to store log files
|
// File type hooks should be provided a path to a directory to store log files
|
||||||
func checkFileHookParams(params map[string]interface{}) {
|
func checkFileHookParams(params map[string]interface{}) {
|
||||||
path, ok := params["path"]
|
path, ok := params["path"]
|
||||||
|
|
|
||||||
|
|
@ -30,17 +30,6 @@ import (
|
||||||
// If something fails here it means that the logging was improperly configured,
|
// If something fails here it means that the logging was improperly configured,
|
||||||
// so we just exit with the error
|
// so we just exit with the error
|
||||||
func SetupHookLogging(hooks []config.LogrusHook, componentName string) {
|
func SetupHookLogging(hooks []config.LogrusHook, componentName string) {
|
||||||
logrus.SetReportCaller(true)
|
|
||||||
logrus.SetFormatter(&utcFormatter{
|
|
||||||
&logrus.TextFormatter{
|
|
||||||
TimestampFormat: "2006-01-02T15:04:05.000000000Z07:00",
|
|
||||||
FullTimestamp: true,
|
|
||||||
DisableColors: false,
|
|
||||||
DisableTimestamp: false,
|
|
||||||
QuoteEmptyFields: true,
|
|
||||||
CallerPrettyfier: callerPrettyfier,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
stdLogAdded := false
|
stdLogAdded := false
|
||||||
for _, hook := range hooks {
|
for _, hook := range hooks {
|
||||||
// Check we received a proper logging level
|
// Check we received a proper logging level
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,7 @@ func NewBaseDendrite(cfg *config.Dendrite, componentName string, options ...Base
|
||||||
logrus.Fatalf("Failed to start due to configuration errors")
|
logrus.Fatalf("Failed to start due to configuration errors")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal.SetupStdLogging()
|
||||||
internal.SetupHookLogging(cfg.Logging, componentName)
|
internal.SetupHookLogging(cfg.Logging, componentName)
|
||||||
internal.SetupPprof()
|
internal.SetupPprof()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue