lnd+rpcserver: initialize new log writer correctly
This commit is contained in:
parent
94f49192cf
commit
3ca2c363fe
25
config.go
25
config.go
@ -951,27 +951,32 @@ func loadConfig() (*config, error) {
|
|||||||
normalizeNetwork(activeNetParams.Name))
|
normalizeNetwork(activeNetParams.Name))
|
||||||
|
|
||||||
// Special show command to list supported subsystems and exit.
|
// Special show command to list supported subsystems and exit.
|
||||||
/*TODO(guggero) fix
|
|
||||||
if cfg.DebugLevel == "show" {
|
if cfg.DebugLevel == "show" {
|
||||||
fmt.Println("Supported subsystems", supportedSubsystems())
|
fmt.Println("Supported subsystems",
|
||||||
|
logWriter.SupportedSubsystems())
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}*/
|
}
|
||||||
|
|
||||||
// Initialize logging at the default logging level.
|
// Initialize logging at the default logging level.
|
||||||
/*TODO(guggero) fix
|
err = logWriter.InitLogRotator(
|
||||||
initLogRotator(
|
|
||||||
filepath.Join(cfg.LogDir, defaultLogFilename),
|
filepath.Join(cfg.LogDir, defaultLogFilename),
|
||||||
cfg.MaxLogFileSize, cfg.MaxLogFiles,
|
cfg.MaxLogFileSize, cfg.MaxLogFiles,
|
||||||
)*/
|
)
|
||||||
|
if err != nil {
|
||||||
|
str := "%s: log rotation setup failed: %v"
|
||||||
|
err = fmt.Errorf(str, funcName, err.Error())
|
||||||
|
fmt.Fprintln(os.Stderr, err)
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
// Parse, validate, and set debug log level(s).
|
// Parse, validate, and set debug log level(s).
|
||||||
/*TODO(guggero) fix
|
err = build.ParseAndSetDebugLevels(cfg.DebugLevel, logWriter)
|
||||||
if err := parseAndSetDebugLevels(cfg.DebugLevel); err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("%s: %v", funcName, err.Error())
|
err = fmt.Errorf("%s: %v", funcName, err.Error())
|
||||||
fmt.Fprintln(os.Stderr, err)
|
fmt.Fprintln(os.Stderr, err)
|
||||||
fmt.Fprintln(os.Stderr, usageMessage)
|
fmt.Fprintln(os.Stderr, usageMessage)
|
||||||
return nil, err
|
return nil, err
|
||||||
}*/
|
}
|
||||||
|
|
||||||
// At least one RPCListener is required. So listen on localhost per
|
// At least one RPCListener is required. So listen on localhost per
|
||||||
// default.
|
// default.
|
||||||
|
8
lnd.go
8
lnd.go
@ -125,10 +125,10 @@ func Main(lisCfg ListenerCfg) error {
|
|||||||
cfg = loadedConfig
|
cfg = loadedConfig
|
||||||
defer func() {
|
defer func() {
|
||||||
ltndLog.Info("Shutdown complete")
|
ltndLog.Info("Shutdown complete")
|
||||||
/* TODO(guggero) fix after refactor
|
err := logWriter.Close()
|
||||||
if logRotator != nil {
|
if err != nil {
|
||||||
logRotator.Close()
|
ltndLog.Errorf("Could not close log rotator: %v", err)
|
||||||
}*/
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Show version at startup.
|
// Show version at startup.
|
||||||
|
10
rpcserver.go
10
rpcserver.go
@ -12,6 +12,7 @@ import (
|
|||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
@ -4342,7 +4343,9 @@ func (r *rpcServer) DebugLevel(ctx context.Context,
|
|||||||
// sub-systems.
|
// sub-systems.
|
||||||
if req.Show {
|
if req.Show {
|
||||||
return &lnrpc.DebugLevelResponse{
|
return &lnrpc.DebugLevelResponse{
|
||||||
SubSystems: "", //TODO(guggero) fix strings.Join(supportedSubsystems(), " "),
|
SubSystems: strings.Join(
|
||||||
|
logWriter.SupportedSubsystems(), " ",
|
||||||
|
),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4350,11 +4353,10 @@ func (r *rpcServer) DebugLevel(ctx context.Context,
|
|||||||
|
|
||||||
// Otherwise, we'll attempt to set the logging level using the
|
// Otherwise, we'll attempt to set the logging level using the
|
||||||
// specified level spec.
|
// specified level spec.
|
||||||
/*TODO(guggero) fix
|
err := build.ParseAndSetDebugLevels(req.LevelSpec, logWriter)
|
||||||
if err := parseAndSetDebugLevels(req.LevelSpec); err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
return &lnrpc.DebugLevelResponse{}, nil
|
return &lnrpc.DebugLevelResponse{}, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user