mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-17 02:53:11 -06:00
Move log creation mutexes up a level to prevent races in unit tests
This commit is contained in:
parent
7900bfeb52
commit
eae2db401b
|
|
@ -101,6 +101,8 @@ func SetupPprof() {
|
|||
|
||||
// SetupStdLogging configures the logging format to standard output. Typically, it is called when the config is not yet loaded.
|
||||
func SetupStdLogging() {
|
||||
levelLogAddedMu.Lock()
|
||||
defer levelLogAddedMu.Unlock()
|
||||
logrus.SetReportCaller(true)
|
||||
logrus.SetFormatter(&utcFormatter{
|
||||
&logrus.TextFormatter{
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ import (
|
|||
// If something fails here it means that the logging was improperly configured,
|
||||
// so we just exit with the error
|
||||
func SetupHookLogging(hooks []config.LogrusHook, componentName string) {
|
||||
levelLogAddedMu.Lock()
|
||||
defer levelLogAddedMu.Unlock()
|
||||
for _, hook := range hooks {
|
||||
// Check we received a proper logging level
|
||||
level, err := logrus.ParseLevel(hook.Level)
|
||||
|
|
@ -85,8 +87,6 @@ func checkSyslogHookParams(params map[string]interface{}) {
|
|||
}
|
||||
|
||||
func setupStdLogHook(level logrus.Level) {
|
||||
levelLogAddedMu.Lock()
|
||||
defer levelLogAddedMu.Unlock()
|
||||
if stdLevelLogAdded[level] {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue