lnd: properly initialize LightningWallet with new config

This commit is contained in:
Olaoluwa Osuntokun committed 2017-07-30 17:52:07 -07:00
1 parent 522712b9a6
commit a73589f3e9
3 files changed
+34 -14

No files matched your search

+12 -11
View File
@@ -36,20 +36,21 @@ func (logWriter) Write(p []byte) (n int, err error) {
// subsystemLoggers map.
//
// Loggers can not be used before the log rotator has been initialized with a
// log file. This must be performed early during application startup by calling
// initLogRotator.
// log file. This must be performed early during application startup by
// calling initLogRotator.
var (
// backendLog is the logging backend used to create all subsystem loggers.
// The backend must not be used before the log rotator has been initialized,
// or data races and/or nil pointer dereferences will occur.
// backendLog is the logging backend used to create all subsystem
// loggers. The backend must not be used before the log rotator has
// been initialized, or data races and/or nil pointer dereferences will
// occur.
backendLog = btclog.NewBackend(logWriter{})
// logRotator is one of the logging outputs. It should be closed on
// application shutdown.
logRotator *rotator.Rotator
// logRotatorPipe is the write-end pipe for writing to the log rotator. It
// is written to by the Write method of the logWriter type.
// logRotatorPipe is the write-end pipe for writing to the log rotator.
// It is written to by the Write method of the logWriter type.
logRotatorPipe *io.PipeWriter
ltndLog = backendLog.Logger("LTND")
@@ -100,9 +101,9 @@ var subsystemLoggers = map[string]btclog.Logger{
"BTCN": btcnLog,
}
// initLogRotator initializes the logging rotater to write logs to logFile and
// initLogRotator initializes the logging rotator to write logs to logFile and
// create roll files in the same directory. It must be called before the
// package-global log rotater variables are used.
// package-global log rotator variables are used.
func initLogRotator(logFile string) {
logDir, _ := filepath.Split(logFile)
err := os.MkdirAll(logDir, 0700)
@@ -149,8 +150,8 @@ func setLogLevels(logLevel string) {
}
}
// logClosure is used to provide a closure over expensive logging operations
// so don't have to be performed when the logging level doesn't warrant it.
// logClosure is used to provide a closure over expensive logging operations so
// don't have to be performed when the logging level doesn't warrant it.
type logClosure func() string
// String invokes the underlying function and returns the result.