-
Notifications
You must be signed in to change notification settings - Fork 211
/
logging.go
89 lines (84 loc) · 4.45 KB
/
logging.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package config
import "go.uber.org/zap/zapcore"
// LogEncoder defines a log encoder kind.
type LogEncoder = string
const (
defaultLoggingLevel = zapcore.InfoLevel
// ConsoleLogEncoder represents logging with plain text.
ConsoleLogEncoder LogEncoder = "console"
// JSONLogEncoder represents logging with JSON.
JSONLogEncoder LogEncoder = "json"
)
// LoggerConfig holds the logging level for each module.
type LoggerConfig struct {
Encoder LogEncoder `mapstructure:"log-encoder"`
AppLoggerLevel string `mapstructure:"app"`
GrpcLoggerLevel string `mapstructure:"grpc"`
P2PLoggerLevel string `mapstructure:"p2p"`
PostLoggerLevel string `mapstructure:"post"`
StateDbLoggerLevel string `mapstructure:"stateDb"`
StateLoggerLevel string `mapstructure:"state"`
AtxHandlerLevel string `mapstructure:"atxHandler"`
AtxDbStoreLoggerLevel string `mapstructure:"atxDbStore"`
BeaconLoggerLevel string `mapstructure:"beacon"`
WeakCoinLoggerLevel string `mapstructure:"weakCoin"`
PoetDbStoreLoggerLevel string `mapstructure:"poetDbStore"`
StoreLoggerLevel string `mapstructure:"store"`
PoetDbLoggerLevel string `mapstructure:"poetDb"`
MeshDBLoggerLevel string `mapstructure:"meshDb"`
TrtlLoggerLevel string `mapstructure:"trtl"`
AtxDbLoggerLevel string `mapstructure:"atxDb"`
BlkEligibilityLoggerLevel string `mapstructure:"block-eligibility"`
MeshLoggerLevel string `mapstructure:"mesh"`
SyncLoggerLevel string `mapstructure:"sync"`
FetcherLoggerLevel string `mapstructure:"fetcher"`
BlockOracleLevel string `mapstructure:"block-oracle"`
HareOracleLoggerLevel string `mapstructure:"hare-oracle"`
HareLoggerLevel string `mapstructure:"hare"`
BlockBuilderLoggerLevel string `mapstructure:"block-builder"`
BlockListenerLoggerLevel string `mapstructure:"block-listener"`
PoetListenerLoggerLevel string `mapstructure:"poet"`
NipostBuilderLoggerLevel string `mapstructure:"nipostBuilder"`
AtxBuilderLoggerLevel string `mapstructure:"atxBuilder"`
HareBeaconLoggerLevel string `mapstructure:"hare-beacon"`
TimeSyncLoggerLevel string `mapstructure:"timesync"`
VMLogLevel string `mapstructure:"vm"`
ProposalListenerLevel string `mapstructure:"proposalListener"`
}
func DefaultLoggingConfig() LoggerConfig {
return LoggerConfig{
Encoder: ConsoleLogEncoder,
AppLoggerLevel: defaultLoggingLevel.String(),
GrpcLoggerLevel: defaultLoggingLevel.String(),
P2PLoggerLevel: zapcore.WarnLevel.String(),
PostLoggerLevel: defaultLoggingLevel.String(),
StateDbLoggerLevel: defaultLoggingLevel.String(),
StateLoggerLevel: defaultLoggingLevel.String(),
AtxDbStoreLoggerLevel: defaultLoggingLevel.String(),
AtxHandlerLevel: defaultLoggingLevel.String(),
BeaconLoggerLevel: defaultLoggingLevel.String(),
WeakCoinLoggerLevel: defaultLoggingLevel.String(),
PoetDbStoreLoggerLevel: defaultLoggingLevel.String(),
StoreLoggerLevel: defaultLoggingLevel.String(),
PoetDbLoggerLevel: defaultLoggingLevel.String(),
MeshDBLoggerLevel: defaultLoggingLevel.String(),
TrtlLoggerLevel: defaultLoggingLevel.String(),
AtxDbLoggerLevel: defaultLoggingLevel.String(),
BlkEligibilityLoggerLevel: defaultLoggingLevel.String(),
MeshLoggerLevel: defaultLoggingLevel.String(),
SyncLoggerLevel: defaultLoggingLevel.String(),
FetcherLoggerLevel: defaultLoggingLevel.String(),
BlockOracleLevel: defaultLoggingLevel.String(),
HareOracleLoggerLevel: defaultLoggingLevel.String(),
HareLoggerLevel: defaultLoggingLevel.String(),
BlockBuilderLoggerLevel: defaultLoggingLevel.String(),
BlockListenerLoggerLevel: defaultLoggingLevel.String(),
PoetListenerLoggerLevel: defaultLoggingLevel.String(),
NipostBuilderLoggerLevel: defaultLoggingLevel.String(),
AtxBuilderLoggerLevel: defaultLoggingLevel.String(),
HareBeaconLoggerLevel: defaultLoggingLevel.String(),
TimeSyncLoggerLevel: defaultLoggingLevel.String(),
VMLogLevel: defaultLoggingLevel.String(),
ProposalListenerLevel: defaultLoggingLevel.String(),
}
}