Skip to content

Commit 8ab05f0

Browse files
committed
build: add yaml tags to embedded LogConfig structs
For any embedded struct, the `yaml:",inline"` tag is required.
1 parent f744a54 commit 8ab05f0

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

build/config.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const (
2727
type LogConfig struct {
2828
Console *consoleLoggerCfg `group:"console" namespace:"console" description:"The logger writing to stdout and stderr."`
2929
File *FileLoggerConfig `group:"file" namespace:"file" description:"The logger writing to LND's standard log file."`
30-
NoCommitHash bool `long:"no-commit-hash" description:"If set, the commit-hash of the current build will not be included in log lines by default."`
30+
NoTimestamps bool `long:"no-timestamps" description:"Omit timestamps from log lines."`
3131
}
3232

3333
// Validate validates the LogConfig struct values.
@@ -45,7 +45,7 @@ func (c *LogConfig) Validate() error {
4545
//nolint:ll
4646
type LoggerConfig struct {
4747
Disable bool `long:"disable" description:"Disable this logger."`
48-
NoTimestamps bool `long:"no-timestamps" description:"Omit timestamps from log lines."`
48+
NoTimestamps bool `long:"no-timestamps"description:"Omit timestamps from log lines."`
4949
CallSite string `long:"call-site" description:"Include the call-site of each log line." choice:"off" choice:"short" choice:"long"`
5050
}
5151

@@ -57,7 +57,7 @@ func DefaultLogConfig() *LogConfig {
5757
Compressor: defaultLogCompressor,
5858
MaxLogFiles: DefaultMaxLogFiles,
5959
MaxLogFileSize: DefaultMaxLogFileSize,
60-
LoggerConfig: LoggerConfig{
60+
LoggerConfig: &LoggerConfig{
6161
CallSite: callSiteOff,
6262
},
6363
},
@@ -92,7 +92,7 @@ func (cfg *LoggerConfig) HandlerOptions() []btclog.HandlerOption {
9292
//
9393
//nolint:ll
9494
type FileLoggerConfig struct {
95-
LoggerConfig
95+
*LoggerConfig `yaml:",inline"`
9696
Compressor string `long:"compressor" description:"Compression algorithm to use when rotating logs." choice:"gzip" choice:"zstd"`
9797
MaxLogFiles int `long:"max-files" description:"Maximum logfiles to keep (0 for no rotation)"`
9898
MaxLogFileSize int `long:"max-file-size" description:"Maximum logfile size in MB"`

build/config_dev.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ const (
2424
//
2525
//nolint:ll
2626
type consoleLoggerCfg struct {
27-
LoggerConfig
28-
Style bool `long:"style" description:"If set, the output will be styled with color and fonts"`
27+
*LoggerConfig `yaml:",inline"`
28+
Style bool `long:"style" description:"If set, the output will be styled with color and fonts"`
2929
}
3030

3131
// defaultConsoleLoggerCfg returns the default consoleLoggerCfg for the dev
3232
// console logger.
3333
func defaultConsoleLoggerCfg() *consoleLoggerCfg {
3434
return &consoleLoggerCfg{
35-
LoggerConfig: LoggerConfig{
35+
LoggerConfig: &LoggerConfig{
3636
CallSite: callSiteShort,
3737
},
3838
}

build/config_prod.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ package build
88
//
99
//nolint:ll
1010
type consoleLoggerCfg struct {
11-
LoggerConfig
11+
*LoggerConfig `yaml:",inline"`
1212
}
1313

1414
// defaultConsoleLoggerCfg returns the default consoleLoggerCfg for the prod
1515
// console logger.
1616
func defaultConsoleLoggerCfg() *consoleLoggerCfg {
1717
return &consoleLoggerCfg{
18-
LoggerConfig: LoggerConfig{
18+
LoggerConfig: &LoggerConfig{
1919
CallSite: callSiteOff,
2020
},
2121
}

0 commit comments

Comments
 (0)