https://github.com/dimfeld/spacelog-levelstring
Log level configuration of spacemonkeygo/spacelog from a string
https://github.com/dimfeld/spacelog-levelstring
Last synced: over 1 year ago
JSON representation
Log level configuration of spacemonkeygo/spacelog from a string
- Host: GitHub
- URL: https://github.com/dimfeld/spacelog-levelstring
- Owner: dimfeld
- License: mit
- Created: 2016-02-24T03:21:44.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-02-24T05:48:15.000Z (over 10 years ago)
- Last Synced: 2025-02-08T08:09:57.735Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This package contains a convenience function that takes a comma-separated
glob-style string and uses `spacelog.SetLevel` to set the log level
on all the matching loggers.
This is designed so that you can easily enable certain debug levels using
methods such as an environment variable or an HTTP endpoint.
```go
// From some variable
config := "incoming*,core*"
levelstring.Configure(config, spacelog.Debug)
// Or straight from the environment
levelstring.Configure(os.Getenv("DEBUG"), spacelog.Debug)
```
See http://godoc.org/github.com/dimfeld/spacelog-levelstring for more examples.
### Limitations
Calls to `Configure` only affect logger names that exist at the time of the call. New
loggers created afterward will use the logger collection's default level.