github.com/phsym/zeroslog@v0.1.1-0.20240224183259-0b7a5ea94339/README.md (about)

     1  # zeroslog
     2  
     3  [![Go Reference](https://pkg.go.dev/badge/github.com/phsym/zeroslog.svg)](https://pkg.go.dev/github.com/phsym/zeroslog) [![license](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](https://raw.githubusercontent.com/phsym/zeroslog/master/LICENSE) [![Build](https://github.com/phsym/zeroslog/actions/workflows/go.yml/badge.svg?branch=main)](https://github.com/phsym/zeroslog/actions/workflows/go.yml) [![codecov](https://codecov.io/gh/phsym/zeroslog/graph/badge.svg?token=VXOLS2AJOO)](https://codecov.io/gh/phsym/zeroslog) [![Go Report Card](https://goreportcard.com/badge/github.com/phsym/zeroslog)](https://goreportcard.com/report/github.com/phsym/zeroslog)
     4  
     5  A zerolog handler for slog
     6  
     7  ## Example
     8  ```go
     9  package main
    10  
    11  import (
    12  	"log/slog"
    13  	"github.com/phsym/zeroslog"
    14  )
    15  
    16  func main() {
    17  	logger := slog.New(
    18          zeroslog.NewJsonHandler(os.Stderr, &zeroslog.HandlerOptions{Level: slog.LevelDebug}),
    19      )
    20  	slog.SetDefault(logger)
    21      slog.Info("Hello world!", "foo", "bar")
    22  }
    23  
    24  ```