Categorygithub.com/spacetab-io/logs-go/v3
package
3.0.0-alpha3
Repository: https://github.com/spacetab-io/logs-go.git
Documentation: pkg.go.dev

# README

logs-go

CircleCI codecov

Wrapper for uber zap logger tuned to work with configuration and sentry hook.

Usage

Initiate new logger filled with struct that implements LogsConfigInterface and use it as common zap logger

package main

import (
	"os"

	cfgstructs "github.com/spacetab-io/configuration-structs-go/v2"
	log "github.com/spacetab-io/logs-go/v3"
)

func main() {
	conf := &cfgstructs.Logs{
		Level:   "debug",
		Format:  "text",
		Colored: true,
		Caller:  cfgstructs.CallerConfig{Show: true, SkipFrames: 1},
		Sentry: &cfgstructs.SentryConfig{
			Enable: true,
			Debug:  true,
			DSN:    os.Getenv("SENTRY_DSN"),
		},
	}

	logger, err := log.Init(conf, "test", "service", "v3.0.0", os.Stdout)
	if err != nil {
		panic(err)
	}

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

Licence

The software is provided under MIT Licence.