https://github.com/keke-li/log
log for service
https://github.com/keke-li/log
go log
Last synced: about 1 year ago
JSON representation
log for service
- Host: GitHub
- URL: https://github.com/keke-li/log
- Owner: KeKe-Li
- License: mit
- Created: 2020-03-23T08:58:01.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-01-06T01:37:56.000Z (over 4 years ago)
- Last Synced: 2025-03-30T07:22:28.537Z (over 1 year ago)
- Topics: go, log
- Language: Go
- Size: 60.5 KB
- Stars: 18
- Watchers: 1
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#### go log system
log is a powerful logging framework that provides log custom log level.
log provides Fatal, Error, Warn, Info, Debug level log. and with the requestID can quickly go to the current line of code.
If you like,please give a star。
#### How to Use
it's very simple and easy to use.
```go
func main(){
l := log.New(log.WithTraceId(trace.NewTraceId()))
ctx := log.NewContext(context.Background(), l)
v, err := rand.Int(rand.Reader, big.NewInt(int64(16)))
if err != nil {
log.ErrorContext(ctx, " rand.In failed", "error", err.Error())
return
}
log.InfoContext(ctx, "the rand Int result", "v", v)
}
```
This use is made of the key and the Value output.
### License
This is free software distributed under the terms of the MIT license