Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion dcrtimed/backend/filesystem/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,6 @@ func New(root, cert, host, clientCert, clientKey string, enableCollections bool,
fs.maxDigests = maxDigests

// Runtime bits
dcrtimewallet.UseLogger(log)
fs.wallet, err = dcrtimewallet.New(cert, host, clientCert, clientKey, passphrase)
if err != nil {
return nil, err
Expand Down
4 changes: 4 additions & 0 deletions dcrtimed/dcrtimed.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
v2 "github.com/decred/dcrtime/api/v2"
"github.com/decred/dcrtime/dcrtimed/backend"
"github.com/decred/dcrtime/dcrtimed/backend/filesystem"
"github.com/decred/dcrtime/dcrtimed/dcrtimewallet"
"github.com/decred/dcrtime/util"
"github.com/gorilla/handlers"
"github.com/gorilla/mux"
Expand Down Expand Up @@ -1442,6 +1443,9 @@ func _main() error {
log.Infof("Network : %v", activeNetParams.Params.Name)
log.Infof("Home dir: %v", loadedCfg.HomeDir)

// Sets subsystem loggers
dcrtimewallet.UseLogger(walletLog)

// Create the data directory in case it does not exist.
err = os.MkdirAll(loadedCfg.DataDir, 0700)
if err != nil {
Expand Down
8 changes: 7 additions & 1 deletion dcrtimed/dcrtimewallet/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,17 @@ import (
var log = slog.Disabled

// UseLogger sets the logger to use for the gRPC server.
func UseLogger(l slog.Logger) {
func UseGrpcLogger(l slog.Logger) {
grpclog.SetLogger(logger{l})
log = l
}

// UseLogger sets the subsystem logger for this package, without
// gRPC logging.
func UseLogger(l slog.Logger) {
log = l
}

// logger uses a slog.Logger to implement the grpclog.Logger interface.
type logger struct {
slog.Logger
Expand Down
6 changes: 4 additions & 2 deletions dcrtimed/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,16 @@ var (
// application shutdown.
logRotator *rotator.Rotator

log = backendLog.Logger("DCRT")
fsbeLog = backendLog.Logger("FSBE")
log = backendLog.Logger("DCRT")
fsbeLog = backendLog.Logger("FSBE")
walletLog = backendLog.Logger("DCRW")
)

// subsystemLoggers maps each subsystem identifier to its associated logger.
var subsystemLoggers = map[string]slog.Logger{
"DCRT": log,
"FSBE": fsbeLog,
"DCRW": walletLog,
}

// initLogRotator initializes the logging rotater to write logs to logFile and
Expand Down
Loading