2022-10-20 18:25:06 +00:00
|
|
|
package logging
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ledgerwatch/log/v3"
|
2022-11-14 16:33:57 +00:00
|
|
|
"github.com/urfave/cli/v2"
|
2022-10-20 18:25:06 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
|
|
|
LogJsonFlag = cli.BoolFlag{
|
|
|
|
Name: "log.json",
|
|
|
|
Usage: "Format console logs with JSON",
|
|
|
|
}
|
|
|
|
|
|
|
|
LogConsoleJsonFlag = cli.BoolFlag{
|
|
|
|
Name: "log.console.json",
|
|
|
|
Usage: "Format console logs with JSON",
|
|
|
|
}
|
|
|
|
|
|
|
|
LogDirJsonFlag = cli.BoolFlag{
|
|
|
|
Name: "log.dir.json",
|
|
|
|
Usage: "Format file logs with JSON",
|
|
|
|
}
|
|
|
|
|
|
|
|
LogVerbosityFlag = cli.StringFlag{
|
|
|
|
Name: "verbosity",
|
|
|
|
Usage: "Set the log level for console logs",
|
|
|
|
Value: log.LvlInfo.String(),
|
|
|
|
}
|
|
|
|
|
|
|
|
LogConsoleVerbosityFlag = cli.StringFlag{
|
|
|
|
Name: "log.console.verbosity",
|
|
|
|
Usage: "Set the log level for console logs",
|
|
|
|
Value: log.LvlInfo.String(),
|
|
|
|
}
|
2023-12-04 04:11:11 +00:00
|
|
|
LogDirDisableFlag = cli.BoolFlag{
|
|
|
|
Name: "log.dir.disable",
|
|
|
|
Usage: "disable disk logging",
|
|
|
|
}
|
2022-10-20 18:25:06 +00:00
|
|
|
LogDirPathFlag = cli.StringFlag{
|
|
|
|
Name: "log.dir.path",
|
|
|
|
Usage: "Path to store user and error logs to disk",
|
|
|
|
}
|
|
|
|
|
2023-06-12 14:30:05 +00:00
|
|
|
LogDirPrefixFlag = cli.StringFlag{
|
|
|
|
Name: "log.dir.prefix",
|
|
|
|
Usage: "The file name prefix for logs stored to disk",
|
|
|
|
}
|
|
|
|
|
2022-10-20 18:25:06 +00:00
|
|
|
LogDirVerbosityFlag = cli.StringFlag{
|
|
|
|
Name: "log.dir.verbosity",
|
|
|
|
Usage: "Set the log verbosity for logs stored to disk",
|
2023-04-07 21:08:44 +00:00
|
|
|
Value: log.LvlInfo.String(),
|
2022-10-20 18:25:06 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
var Flags = []cli.Flag{
|
2022-11-14 16:33:57 +00:00
|
|
|
&LogJsonFlag,
|
|
|
|
&LogConsoleJsonFlag,
|
|
|
|
&LogDirJsonFlag,
|
|
|
|
&LogVerbosityFlag,
|
|
|
|
&LogConsoleVerbosityFlag,
|
2023-12-04 04:11:11 +00:00
|
|
|
&LogDirDisableFlag,
|
2022-11-14 16:33:57 +00:00
|
|
|
&LogDirPathFlag,
|
2023-06-12 14:30:05 +00:00
|
|
|
&LogDirPrefixFlag,
|
2022-11-14 16:33:57 +00:00
|
|
|
&LogDirVerbosityFlag,
|
2022-10-20 18:25:06 +00:00
|
|
|
}
|