An open API service indexing awesome lists of open source software.

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

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...
}
```