From b00b31646ab420019db9bdc87f79322863b9c9fb Mon Sep 17 00:00:00 2001 From: Caleb Brown Date: Wed, 13 Apr 2022 11:18:53 +1000 Subject: [PATCH] Split NewLogger into two so we can use a custom logrus instance. --- log/log.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/log/log.go b/log/log.go index 4dd71ae4cba..aff02625d0c 100644 --- a/log/log.go +++ b/log/log.go @@ -38,11 +38,16 @@ func NewLogger(logLevel Level) *Logger { logrusLevel := parseLogrusLevel(logLevel) logrusLog.SetLevel(logrusLevel) + return NewLogrusLogger(logrusLog) +} + +// NewLogrusLogger creates an instance of *Logger backed by the supplied +// logrusLog instance. +func NewLogrusLogger(logrusLog *logrus.Logger) *Logger { logrLogger := logrusr.New(logrusLog) logger := &Logger{ &logrLogger, } - return logger }