-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build+config: move file logger specific options to logging.file
#9233
build+config: move file logger specific options to logging.file
#9233
Conversation
Important Review skippedAuto reviews are limited to specific labels. 🏷️ Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
6159f79
to
4f38b2c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice, LGTM 🎉
build/log.go
Outdated
@@ -52,9 +52,9 @@ var logCompressors = map[string]string{ | |||
Zstd: "zst", | |||
} | |||
|
|||
// SuportedLogCompressor returns whether or not logCompressor is a supported | |||
// supportedLogCompressor returns whether or not logCompressor is a supported |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these will be used in other projects (e.g. tapd
), so we shouldn't un-export them.
build/config.go
Outdated
|
||
// DefaultMaxLogFiles is the default maximum number of log files to | ||
// keep. | ||
DefaultMaxLogFiles = 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we touch these, I also feel like it would be a good idea to slightly increase those numbers... Maybe 10 and 20 respectively? It just seems to happen often that users don't have what we need in their logs anymore. Or perhaps we could make it dependent on the log level? If they're running with DBG or higher, increase the numbers? That would probably be out of scope for this PR, just brain storming a bit here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool - updated the defaults in a commit at the end (just to keep this commit a refactor) :)
|
||
cfg.LogConfig.File.MaxLogFiles = cfg.MaxLogFiles | ||
} | ||
if cfg.MaxLogFileSize != build.DefaultMaxLogFileSize { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice refactor! Just a new nits and should be good to go.
|
||
// FileLoggerConfig extends LoggerConfig with specific log file options. | ||
// | ||
//nolint:lll |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be removed now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wanted to comment the same when going through it commit by commit. But longer lines are added to it later, so I think it's still needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yeah lol 🙃 will re-add (in correct commit)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh ok didn't notice that😂
config.go
Outdated
@@ -315,8 +313,8 @@ type Config struct { | |||
ReadMacPath string `long:"readonlymacaroonpath" description:"Path to write the read-only macaroon for lnd's RPC and REST services if it doesn't exist"` | |||
InvoiceMacPath string `long:"invoicemacaroonpath" description:"Path to the invoice-only macaroon for lnd's RPC and REST services if it doesn't exist"` | |||
LogDir string `long:"logdir" description:"Directory to log output."` | |||
MaxLogFiles int `long:"maxlogfiles" description:"Maximum logfiles to keep (0 for no rotation)"` | |||
MaxLogFileSize int `long:"maxlogfilesize" description:"Maximum logfile size in MB"` | |||
MaxLogFiles int `long:"maxlogfiles" description:"Maximum logfiles to keep (0 for no rotation). DEPRECATED: use --logging.file.max-files instead"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add hidden
flag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yeah good idea
to config_prod.go in preparation for adding a shared config.go file.
Move all shared code to config.go which has no build tags.
In preparation for extending LoggerConfig with file specific config.
4f38b2c
to
f1b900a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick reviews ya'll! 🌊
config.go
Outdated
@@ -315,8 +313,8 @@ type Config struct { | |||
ReadMacPath string `long:"readonlymacaroonpath" description:"Path to write the read-only macaroon for lnd's RPC and REST services if it doesn't exist"` | |||
InvoiceMacPath string `long:"invoicemacaroonpath" description:"Path to the invoice-only macaroon for lnd's RPC and REST services if it doesn't exist"` | |||
LogDir string `long:"logdir" description:"Directory to log output."` | |||
MaxLogFiles int `long:"maxlogfiles" description:"Maximum logfiles to keep (0 for no rotation)"` | |||
MaxLogFileSize int `long:"maxlogfilesize" description:"Maximum logfile size in MB"` | |||
MaxLogFiles int `long:"maxlogfiles" description:"Maximum logfiles to keep (0 for no rotation). DEPRECATED: use --logging.file.max-files instead"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yeah good idea
build/config.go
Outdated
|
||
// DefaultMaxLogFiles is the default maximum number of log files to | ||
// keep. | ||
DefaultMaxLogFiles = 3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool - updated the defaults in a commit at the end (just to keep this commit a refactor) :)
This is not a breaking change since the logcompressor config option has not been released yet.
Add deprecation notices but continue to read both.
f1b900a
to
e547d21
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM⛵️
This PR:
logcompressor
option tologging.file.compressor
(this is not a breaking change since thelogcompressor
option has not yet been included in a release.logging.file.max-file-size
andlogging.file.max-files
options and deprecates the oldmaxlogfiles
andmaxlogfilesize
options. Both will work for the time being.