mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-03 10:12:28 +02:00
build: separate sublogger and rotator pipe management
These are two separate concerns. So this commit splits them up and just passes a LogWriter from the one to the other. This will become cleaner in an upcoming commit where the Rotator will implement io.Writer and there will no longer be a need for LogWriter.
This commit is contained in:
8
log.go
8
log.go
@@ -95,7 +95,7 @@ var (
|
||||
|
||||
// genSubLogger creates a logger for a subsystem. We provide an instance of
|
||||
// a signal.Interceptor to be able to shutdown in the case of a critical error.
|
||||
func genSubLogger(root *build.RotatingLogWriter,
|
||||
func genSubLogger(root *build.SubLoggerManager,
|
||||
interceptor signal.Interceptor) func(string) btclog.Logger {
|
||||
|
||||
// Create a shutdown function which will request shutdown from our
|
||||
@@ -116,7 +116,7 @@ func genSubLogger(root *build.RotatingLogWriter,
|
||||
}
|
||||
|
||||
// SetupLoggers initializes all package-global logger variables.
|
||||
func SetupLoggers(root *build.RotatingLogWriter, interceptor signal.Interceptor) {
|
||||
func SetupLoggers(root *build.SubLoggerManager, interceptor signal.Interceptor) {
|
||||
genLogger := genSubLogger(root, interceptor)
|
||||
|
||||
// Now that we have the proper root logger, we can replace the
|
||||
@@ -193,7 +193,7 @@ func SetupLoggers(root *build.RotatingLogWriter, interceptor signal.Interceptor)
|
||||
|
||||
// AddSubLogger is a helper method to conveniently create and register the
|
||||
// logger of one or more sub systems.
|
||||
func AddSubLogger(root *build.RotatingLogWriter, subsystem string,
|
||||
func AddSubLogger(root *build.SubLoggerManager, subsystem string,
|
||||
interceptor signal.Interceptor, useLoggers ...func(btclog.Logger)) {
|
||||
|
||||
// genSubLogger will return a callback for creating a logger instance,
|
||||
@@ -208,7 +208,7 @@ func AddSubLogger(root *build.RotatingLogWriter, subsystem string,
|
||||
|
||||
// SetSubLogger is a helper method to conveniently register the logger of a sub
|
||||
// system.
|
||||
func SetSubLogger(root *build.RotatingLogWriter, subsystem string,
|
||||
func SetSubLogger(root *build.SubLoggerManager, subsystem string,
|
||||
logger btclog.Logger, useLoggers ...func(btclog.Logger)) {
|
||||
|
||||
root.RegisterSubLogger(subsystem, logger)
|
||||
|
Reference in New Issue
Block a user