https://github.com/infiniteloopcloud/log
Yet another log package
https://github.com/infiniteloopcloud/log
Last synced: about 2 months ago
JSON representation
Yet another log package
- Host: GitHub
- URL: https://github.com/infiniteloopcloud/log
- Owner: infiniteloopcloud
- License: apache-2.0
- Created: 2022-02-06T09:22:33.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-30T08:02:31.000Z (about 3 years ago)
- Last Synced: 2023-07-27T22:13:36.590Z (almost 3 years ago)
- Language: Go
- Size: 21.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Log
### Usage
```go
package main
import (
"context"
"errors"
"fmt"
"github.com/infiniteloopcloud/log"
)
const (
CorrelationID log.ContextField = "correlation_id"
)
func main() {
// Set this globally
log.SetLevel(log.LevelToUint())
log.SetLoggableFields([]fmt.Stringer{CorrelationID})
ctx := context.Background()
ctx = context.WithValue(ctx, CorrelationID, "123456")
log.Error(ctx, errors.New(""), "")
log.Errorf(ctx, errors.New(""), "test: %s", "test")
log.Warn(ctx, "")
log.Info(ctx, "")
log.Debug(ctx, "")
// etc...
}
```