https://github.com/vardius/golog
Go logger
https://github.com/vardius/golog
logger logging logging-library
Last synced: about 1 year ago
JSON representation
Go logger
- Host: GitHub
- URL: https://github.com/vardius/golog
- Owner: vardius
- License: mit
- Created: 2016-07-18T08:59:16.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2021-07-09T08:12:48.000Z (almost 5 years ago)
- Last Synced: 2025-03-24T16:55:55.637Z (over 1 year ago)
- Topics: logger, logging, logging-library
- Language: Go
- Homepage:
- Size: 41 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: .github/CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
- Code of conduct: .github/CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
π golog
================
[](https://travis-ci.org/vardius/golog)
[](https://goreportcard.com/report/github.com/vardius/golog)
[](https://codecov.io/gh/vardius/golog)
[](https://pkg.go.dev/github.com/vardius/golog)
[](https://github.com/vardius/golog/blob/master/LICENSE.md)

golog - Logger
π ABOUT
==================================================
Contributors:
* [RafaΕ Lorenz](http://rafallorenz.com)
Want to contribute ? Feel free to send pull requests!
Have problems, bugs, feature ideas?
We are using the github [issue tracker](https://github.com/vardius/golog/issues) to manage them.
## π Documentation
For __examples__ **visit [godoc#pkg-examples](http://godoc.org/github.com/vardius/golog#pkg-examples)**
For **GoDoc** reference, **visit [pkg.go.dev](https://pkg.go.dev/github.com/vardius/golog)**
π HOW TO USE
==================================================
## π« Basic example
```go
package main
import (
"fmt"
"context"
"github.com/vardius/golog"
)
func main() {
ctx := context.Background()
logger := golog.New()
logger.Debug(ctx context.Context, fmt.Sprintf("Hello %s!", "you"))
}
```
## π¦ As a package
```go
package mylogger
import (
"context"
"github.com/vardius/golog"
)
var Logger golog.Logger
func SetFlags(flag int) {
Logger.SetFlags(flag)
}
func SetVerbosity(verbosity golog.Verbose) {
Logger.SetVerbosity(verbosity)
}
func Debug(ctx context.Context, v string) {
Logger.Debug(ctx, v)
}
func Info(ctx context.Context, v string) {
Logger.Info(ctx, v)
}
func Warning(ctx context.Context, v string) {
Logger.Warning(ctx, v)
}
func Error(ctx context.Context, v string) {
Logger.Error(ctx, v)
}
func Critical(ctx context.Context, v string) {
Logger.Critical(ctx, v)
}
func Fatal(ctx context.Context, v string) {
Logger.Fatal(ctx, v)
}
func init() {
Logger = golog.New()
}
```
usage:
```go
package main
import (
"fmt"
"mylogger"
)
func main() {
mylogger.Debug(ctx context.Context, fmt.Sprintf("Hello %s!", "you"))
}
```
π [License](LICENSE.md)
-------
This package is released under the MIT license. See the complete license in the package