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

https://github.com/spacetab-io/logs-go

golang logging wrapper
https://github.com/spacetab-io/logs-go

go golang logging logrus wrapper

Last synced: about 1 month ago
JSON representation

golang logging wrapper

Awesome Lists containing this project

README

        

logs-go
-------

[![CircleCI](https://circleci.com/gh/spacetab-io/logs-go.svg?style=shield)](https://circleci.com/gh/spacetab-io/logs-go) [![codecov](https://codecov.io/gh/spacetab-io/logs-go/graph/badge.svg)](https://codecov.io/gh/spacetab-io/logs-go)

Wrapper for [zerolog](https://github.com/rs/zerolog) tuned to work with [configuration](https://github.com/spacetab-io/configuration-go) and
sentry hook.

## Usage

Initiate new logger with filled `log.Config` and use it as common zerolog

```go
package main

import (
log "github.com/spacetab-io/logs-go/v2"
)

func main() {
conf := log.Config{
Level: "warn",
Format: "text",
Caller: &log.CallerConfig{
Disabled: false,
CallerSkipFrames: 2,
},
Sentry: &log.SentryConfig{
Enable: true,
DSN: "http://dsn.sentry.com",
},
}

if err := log.Init("test", conf, "logs-go", "v2.*.*", nil); err != nil {
panic(err)
}

log.Warn().Msg("log some warning")
}
```

## Licence

The software is provided under [MIT Licence](LICENCE).