[] Refactor logger tag configuration
Some checks failed
/ DCO (pull_request) Failing after 33s
/ Vulncheck (pull_request) Successful in 56s
/ Builds (pull_request) Successful in 1m2s
/ OCI image (pull_request) Successful in 1m21s
/ Lint (pull_request) Successful in 2m51s
/ Tests (pull_request) Successful in 1m43s
/ Integration tests (pull_request) Successful in 7m17s
Some checks failed
/ DCO (pull_request) Failing after 33s
/ Vulncheck (pull_request) Successful in 56s
/ Builds (pull_request) Successful in 1m2s
/ OCI image (pull_request) Successful in 1m21s
/ Lint (pull_request) Successful in 2m51s
/ Tests (pull_request) Successful in 1m43s
/ Integration tests (pull_request) Successful in 7m17s
Signed-off-by: Pavel Pogodaev <p.pogodaev@yadro.com>
This commit is contained in:
parent
9cf2a4f0e0
commit
71a9794222
3 changed files with 14 additions and 14 deletions
|
@ -112,7 +112,7 @@ const (
|
|||
|
||||
cfgLoggerTags = "logger.tags"
|
||||
cfgLoggerTagsPrefixTmpl = cfgLoggerTags + ".%d."
|
||||
cfgLoggerTagsNameTmpl = cfgLoggerTagsPrefixTmpl + "name"
|
||||
cfgLoggerTagsNameTmpl = cfgLoggerTagsPrefixTmpl + "names"
|
||||
cfgLoggerTagsLevelTmpl = cfgLoggerTagsPrefixTmpl + "level"
|
||||
|
||||
// Wallet.
|
||||
|
@ -509,8 +509,8 @@ func fetchLogTagsConfig(v *viper.Viper, defaultLvl zapcore.Level) (map[string]za
|
|||
res := make(map[string]zapcore.Level)
|
||||
|
||||
for i := 0; ; i++ {
|
||||
name := v.GetString(fmt.Sprintf(cfgLoggerTagsNameTmpl, i))
|
||||
if name == "" {
|
||||
tagNames := v.GetString(fmt.Sprintf(cfgLoggerTagsNameTmpl, i))
|
||||
if tagNames == "" {
|
||||
break
|
||||
}
|
||||
|
||||
|
@ -522,7 +522,9 @@ func fetchLogTagsConfig(v *viper.Viper, defaultLvl zapcore.Level) (map[string]za
|
|||
}
|
||||
}
|
||||
|
||||
res[name] = lvl
|
||||
for _, tagName := range strings.Split(tagNames, ",") {
|
||||
res[tagName] = lvl
|
||||
}
|
||||
}
|
||||
|
||||
if len(res) == 0 && !v.IsSet(cfgLoggerTags) {
|
||||
|
|
|
@ -30,8 +30,7 @@ logger:
|
|||
thereafter: 100
|
||||
interval: 1s
|
||||
tags:
|
||||
- name: app
|
||||
- name: datapath
|
||||
- names: app,datapath
|
||||
level: debug
|
||||
|
||||
server:
|
||||
|
|
|
@ -175,10 +175,9 @@ logger:
|
|||
thereafter: 100
|
||||
interval: 1s
|
||||
tags:
|
||||
- name: "app"
|
||||
- names: "app,datapath"
|
||||
level: info
|
||||
- name: "datapath"
|
||||
- name: "external_storage_tree"
|
||||
- names: "external_storage_tree"
|
||||
```
|
||||
|
||||
| Parameter | Type | SIGHUP reload | Default value | Description |
|
||||
|
@ -198,14 +197,14 @@ parameter. Available tags:
|
|||
|
||||
```yaml
|
||||
tags:
|
||||
- name: "app"
|
||||
- names: "app,datapath"
|
||||
level: info
|
||||
```
|
||||
|
||||
| Parameter | Type | SIGHUP reload | Default value | Description |
|
||||
|-----------------------|------------|---------------|---------------------------|-------------------------------------------------------------------------------------------------------|
|
||||
| `name` | `string` | yes | | Tag name. Possible values see below in `Tag values` section. |
|
||||
| `level` | `string` | yes | Value from `logger.level` | Logging level for specific tag. Possible values: `debug`, `info`, `warn`, `dpanic`, `panic`, `fatal`. |
|
||||
| Parameter | Type | SIGHUP reload | Default value | Description |
|
||||
|-----------|------------|---------------|---------------------------|-------------------------------------------------------------------------------------------------------|
|
||||
| `names` | `[]string` | yes | | Tag names separated by `,`. Possible values see below in `Tag values` section. |
|
||||
| `level` | `string` | yes | Value from `logger.level` | Logging level for specific tag. Possible values: `debug`, `info`, `warn`, `dpanic`, `panic`, `fatal`. |
|
||||
|
||||
### Tag values
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue