mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 23:18:15 -05:00
Logrus hooks for terminal vs log-file output (#16102)
## Review after #16059 **What type of PR is this?** Feature **What does this PR do?** This PR introduces logrus writer hooks into the logging of prysm. when log-format is text: - set the default logrus output to be `io.Discard` - create a writer hook for terminal, with formatting and coloring enabled. - create a separate writer hook for log-file (if enabled), without coloring. This immediately allows for having formatted/colored terminal logs, while keeping the log-file clean.
This commit is contained in:
@@ -86,7 +86,7 @@ func main() {
|
||||
|
||||
logFileName := ctx.String(cmd.LogFileName.Name)
|
||||
if logFileName != "" {
|
||||
if err := logs.ConfigurePersistentLogging(logFileName); err != nil {
|
||||
if err := logs.ConfigurePersistentLogging(logFileName, format); err != nil {
|
||||
log.WithError(err).Error("Failed to configuring logging to disk.")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user