mirror of
https://github.com/lightninglabs/aperture.git
synced 2025-12-17 00:54:20 +01:00
auth: LsatAuthenticator -> L402Authenticator sed -i 's/LsatAuthenticator/L402Authenticator/g' aperture.go auth/authenticator.go auth/authenticator_test.go rename package lsat to l402 git mv lsat/ l402 sed 's@aperture/lsat@aperture/l402@g' -i `git grep -l aperture/lsat` sed -i 's@package lsat@package l402@' `git grep -l 'package lsat'` sed -i 's@lsat\.@l402.@g' -i `git grep -l 'lsat\.'` sed 's@l402.Id@lsat.Id@' -i mint/mint_test.go replace lsat with l402 in the code sed 's@lsat@l402@' -i mint/mint_test.go sed 's@Lsat@L402@' -i l402/client_interceptor.go sed 's@lsatstore@l402store@' -i l402/store_test.go replace LSAT to L402 in comments sed '/\/\//s@LSAT@L402@g' -i `git grep -l '//.*LSAT'` replace LSAT -> L402 in the code, skip when a string starts with it sed 's@\([^"/]\)LSAT@\1L402@g' -i `git grep -l LSAT`
56 lines
1.7 KiB
Go
56 lines
1.7 KiB
Go
package aperture
|
|
|
|
import (
|
|
"github.com/btcsuite/btclog"
|
|
"github.com/lightninglabs/aperture/auth"
|
|
"github.com/lightninglabs/aperture/l402"
|
|
"github.com/lightninglabs/aperture/proxy"
|
|
"github.com/lightninglabs/lndclient"
|
|
"github.com/lightningnetwork/lnd"
|
|
"github.com/lightningnetwork/lnd/build"
|
|
"github.com/lightningnetwork/lnd/signal"
|
|
)
|
|
|
|
const Subsystem = "APER"
|
|
|
|
var (
|
|
logWriter = build.NewRotatingLogWriter()
|
|
log = build.NewSubLogger(Subsystem, nil)
|
|
)
|
|
|
|
// SetupLoggers initializes all package-global logger variables.
|
|
func SetupLoggers(root *build.RotatingLogWriter, intercept signal.Interceptor) {
|
|
genLogger := genSubLogger(root, intercept)
|
|
|
|
logWriter = root
|
|
log = build.NewSubLogger(Subsystem, genLogger)
|
|
|
|
lnd.SetSubLogger(root, Subsystem, log)
|
|
lnd.AddSubLogger(root, auth.Subsystem, intercept, auth.UseLogger)
|
|
lnd.AddSubLogger(root, l402.Subsystem, intercept, l402.UseLogger)
|
|
lnd.AddSubLogger(root, proxy.Subsystem, intercept, proxy.UseLogger)
|
|
lnd.AddSubLogger(root, "LNDC", intercept, lndclient.UseLogger)
|
|
}
|
|
|
|
// 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,
|
|
interceptor signal.Interceptor) func(string) btclog.Logger {
|
|
|
|
// Create a shutdown function which will request shutdown from our
|
|
// interceptor if it is listening.
|
|
shutdown := func() {
|
|
if !interceptor.Listening() {
|
|
return
|
|
}
|
|
|
|
interceptor.RequestShutdown()
|
|
}
|
|
|
|
// Return a function which will create a sublogger from our root
|
|
// logger without shutdown fn.
|
|
return func(tag string) btclog.Logger {
|
|
return root.GenSubLogger(tag, shutdown)
|
|
}
|
|
}
|