Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/qmsk/go-logging
Trivial logging package for Go libraries
https://github.com/qmsk/go-logging
Last synced: about 1 month ago
JSON representation
Trivial logging package for Go libraries
- Host: GitHub
- URL: https://github.com/qmsk/go-logging
- Owner: qmsk
- Created: 2018-02-24T18:12:15.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-22T17:44:35.000Z (about 6 years ago)
- Last Synced: 2023-08-10T23:22:23.295Z (over 1 year ago)
- Language: Go
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Usage
The zero-valued `logging.Logging` struct functions as a no-op logger that does not output anything.
### `mypackage/logging.go`
```go
package mypackageimport (
"github.com/qmsk/go-logging"
)var log logging.Logging
func SetLogging(l logging.Logging) {
log = l
}
```### `cmd/mycmd/main.go`
```go
import (
"github.com/qmsk/go-logging"
"flag"
".../mypackage"
)var LoggingOptions logging.Options
func init() {
LoggingOptions.InitFlags()
}func main() {
flag.Parse()mypackage.SetLogging(LoggingOptions.MakeLogging())
...
}
```