ipfs / ipfs/go-log

Can't set loglevel of subsystems properly

Open
#150 4 comments 0 reactions 0 assignees View on GitHub
need/triage
Dominant language
Go
Stars
63
Forks
54
PR merge metrics
No merged PRs in 30d

Description

I have a package that has a lot of subpackages. The loggers get initialized like this for each package;

```go
var log = log2.Logger("hwdata:cli")
var log = log2.Logger("hwdata:system")
var log = log2.Logger("hwdata:cpu")
```

When I include this project into another project, I want to set all the loglevels of this subsystem to info;
```bash
GOLOG_LOG_LEVEL="debug,hwdata=info" go run .
```

This doesn't work. It still shows `hwdata:cpu` with level debug.
Then I tried the "regex" setup that was described in the readme.md;
```bash
GOLOG_LOG_LEVEL="debug,hwdata:.*=info" go run .
```

This also doesn't work

I now have to write it like this;
```bash
GOLOG_LOG_LEVEL="debug,hwdata:cpu=info,hwdata:system=info,hwdata:cli=info" go run .
```

which is kind of ineffective, especially since I have about 20 of those subsystems. Shouldn't this just work on a subsystem level basis? Or is the ":" that is mentioned in the readme just arbitrary and doesn't it work with subsystems like that at all?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.