mirror of
https://github.com/crazy-max/diun.git
synced 2025-12-21 21:33:22 +01:00
Allow to disable log color output (#288)
Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
@@ -21,6 +21,7 @@ Flags:
|
||||
--log-level="info" Set log level ($LOG_LEVEL).
|
||||
--log-json Enable JSON logging output ($LOG_JSON).
|
||||
--log-caller Add file:line of the caller to log output ($LOG_CALLER).
|
||||
--log-nocolor Disables the colorized output ($LOG_NOCOLOR).
|
||||
--test-notif Test notification settings.
|
||||
```
|
||||
|
||||
@@ -34,3 +35,4 @@ Following environment variables can be used in place:
|
||||
| `LOG_LEVEL` | `info` | Log level output |
|
||||
| `LOG_JSON` | `false` | Enable JSON logging output |
|
||||
| `LOG_CALLER` | `false` | Enable to add `file:line` of the caller |
|
||||
| `LOG_NOCOLOR` | `false` | Disables the colorized output |
|
||||
|
||||
@@ -20,6 +20,7 @@ func Configure(cli *model.Cli) {
|
||||
if !cli.LogJSON {
|
||||
w = zerolog.ConsoleWriter{
|
||||
Out: os.Stdout,
|
||||
NoColor: cli.LogNoColor,
|
||||
TimeFormat: time.RFC1123,
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -9,5 +9,6 @@ type Cli struct {
|
||||
LogLevel string `kong:"name='log-level',env='LOG_LEVEL',default='info',help='Set log level.'"`
|
||||
LogJSON bool `kong:"name='log-json',env='LOG_JSON',default='false',help='Enable JSON logging output.'"`
|
||||
LogCaller bool `kong:"name='log-caller',env='LOG_CALLER',default='false',help='Add file:line of the caller to log output.'"`
|
||||
LogNoColor bool `kong:"name='log-nocolor',env='LOG_NOCOLOR',default='false',help='Disables the colorized output.'"`
|
||||
TestNotif bool `kong:"name='test-notif',default='false',help='Test notification settings.'"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user