mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 21:08:10 -05:00
Log: Add milliseconds to log timestamps (#15496)
This commit is contained in:
3
changelog/manu-log-ms.md
Normal file
3
changelog/manu-log-ms.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
### Changed
|
||||||
|
- Add milliseconds to log timestamps.
|
||||||
|
|
||||||
@@ -7,7 +7,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
runtimeDebug "runtime/debug"
|
runtimeDebug "runtime/debug"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/builder"
|
"github.com/OffchainLabs/prysm/v6/beacon-chain/builder"
|
||||||
"github.com/OffchainLabs/prysm/v6/beacon-chain/node"
|
"github.com/OffchainLabs/prysm/v6/beacon-chain/node"
|
||||||
@@ -167,7 +166,7 @@ func before(ctx *cli.Context) error {
|
|||||||
switch format {
|
switch format {
|
||||||
case "text":
|
case "text":
|
||||||
formatter := new(prefixed.TextFormatter)
|
formatter := new(prefixed.TextFormatter)
|
||||||
formatter.TimestampFormat = time.DateTime
|
formatter.TimestampFormat = "2006-01-02 15:04:05.00"
|
||||||
formatter.FullTimestamp = true
|
formatter.FullTimestamp = true
|
||||||
|
|
||||||
// If persistent log files are written - we disable the log messages coloring because
|
// If persistent log files are written - we disable the log messages coloring because
|
||||||
@@ -183,7 +182,9 @@ func before(ctx *cli.Context) error {
|
|||||||
|
|
||||||
logrus.SetFormatter(f)
|
logrus.SetFormatter(f)
|
||||||
case "json":
|
case "json":
|
||||||
logrus.SetFormatter(&logrus.JSONFormatter{})
|
logrus.SetFormatter(&logrus.JSONFormatter{
|
||||||
|
TimestampFormat: "2006-01-02 15:04:05.00",
|
||||||
|
})
|
||||||
case "journald":
|
case "journald":
|
||||||
if err := journald.Enable(); err != nil {
|
if err := journald.Enable(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ func main() {
|
|||||||
switch format {
|
switch format {
|
||||||
case "text":
|
case "text":
|
||||||
formatter := new(prefixed.TextFormatter)
|
formatter := new(prefixed.TextFormatter)
|
||||||
formatter.TimestampFormat = time.DateTime
|
formatter.TimestampFormat = "2006-01-02 15:04:05.00"
|
||||||
formatter.FullTimestamp = true
|
formatter.FullTimestamp = true
|
||||||
// If persistent log files are written - we disable the log messages coloring because
|
// If persistent log files are written - we disable the log messages coloring because
|
||||||
// the colors are ANSI codes and seen as gibberish in the log files.
|
// the colors are ANSI codes and seen as gibberish in the log files.
|
||||||
@@ -73,7 +73,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
logrus.SetFormatter(f)
|
logrus.SetFormatter(f)
|
||||||
case "json":
|
case "json":
|
||||||
logrus.SetFormatter(&logrus.JSONFormatter{})
|
logrus.SetFormatter(&logrus.JSONFormatter{
|
||||||
|
TimestampFormat: "2006-01-02 15:04:05.00",
|
||||||
|
})
|
||||||
case "journald":
|
case "journald":
|
||||||
if err := journald.Enable(); err != nil {
|
if err := journald.Enable(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
runtimeDebug "runtime/debug"
|
runtimeDebug "runtime/debug"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/OffchainLabs/prysm/v6/cmd"
|
"github.com/OffchainLabs/prysm/v6/cmd"
|
||||||
accountcommands "github.com/OffchainLabs/prysm/v6/cmd/validator/accounts"
|
accountcommands "github.com/OffchainLabs/prysm/v6/cmd/validator/accounts"
|
||||||
@@ -152,7 +151,7 @@ func main() {
|
|||||||
switch format {
|
switch format {
|
||||||
case "text":
|
case "text":
|
||||||
formatter := new(prefixed.TextFormatter)
|
formatter := new(prefixed.TextFormatter)
|
||||||
formatter.TimestampFormat = time.DateTime
|
formatter.TimestampFormat = "2006-01-02 15:04:05.00"
|
||||||
formatter.FullTimestamp = true
|
formatter.FullTimestamp = true
|
||||||
// If persistent log files are written - we disable the log messages coloring because
|
// If persistent log files are written - we disable the log messages coloring because
|
||||||
// the colors are ANSI codes and seen as gibberish in the log files.
|
// the colors are ANSI codes and seen as gibberish in the log files.
|
||||||
@@ -165,7 +164,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
logrus.SetFormatter(f)
|
logrus.SetFormatter(f)
|
||||||
case "json":
|
case "json":
|
||||||
logrus.SetFormatter(&logrus.JSONFormatter{})
|
logrus.SetFormatter(&logrus.JSONFormatter{
|
||||||
|
TimestampFormat: "2006-01-02 15:04:05.00",
|
||||||
|
})
|
||||||
case "journald":
|
case "journald":
|
||||||
if err := journald.Enable(); err != nil {
|
if err := journald.Enable(); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ var stateTransitionCommand = &cli.Command{
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
customFormatter := new(prefixed.TextFormatter)
|
customFormatter := new(prefixed.TextFormatter)
|
||||||
customFormatter.TimestampFormat = time.DateTime
|
customFormatter.TimestampFormat = "2006-01-02 15:04:05.00"
|
||||||
customFormatter.FullTimestamp = true
|
customFormatter.FullTimestamp = true
|
||||||
log.SetFormatter(customFormatter)
|
log.SetFormatter(customFormatter)
|
||||||
app := cli.App{}
|
app := cli.App{}
|
||||||
|
|||||||
Reference in New Issue
Block a user