zap

package module
v3.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2023 License: MIT Imports: 9 Imported by: 5

README

GoZix Zap

License Documentation

Release Build Status Go Report Card Code Coverage

The bundle provide a Zap integration to GoZix application.

Installation

go get github.com/gozix/zap/v3

Dependencies

Configuration example

time_encoder config can be ("iso8601", "millis", "nanos") and only for "console" and "json" encoding

{
  "zap": {
    "cores": {
      "console": {
        "type": "stream",
        "level": "debug",
        "encoding": "console",
        "message_key": "message",
        "time_encoder": "iso8601"
      },
      "json": {
        "type": "stream",
        "level": "debug",
        "encoding": "json",
        "message_key": "message",
        "time_encoder": "millis"
      }
    },
    "caller": true,
    "fields": [{
      "key": "team",
      "value": "any team name"
    }, {
      "key": "service",
      "value": "any service name"
    }],
    "stacktrace": "error",
    "development": true
  }
}

Built-in DI options

Name Description
AsCoreFactory Add an factory

Cores

Documentation

You can find documentation on pkg.go.dev and read source code if needed.

Questions

If you have any questions, feel free to create an issue.

Documentation

Index

Constants

View Source
const BundleName = "zap"

BundleName is default definition name.

Variables

This section is empty.

Functions

func AsCoreFactory

func AsCoreFactory() di.ProvideOption

AsCoreFactory is syntax sugar for the di container.

Types

type Bundle

type Bundle struct{}

Bundle implements the glue.Bundle interface.

func NewBundle

func NewBundle() *Bundle

NewBundle create bundle instance.

func (*Bundle) Build

func (b *Bundle) Build(builder di.Builder) (err error)

Build implements the glue.Bundle interface.

func (*Bundle) DependsOn

func (b *Bundle) DependsOn() []string

func (*Bundle) Name

func (b *Bundle) Name() string

type CoreFactory

type CoreFactory interface {
	Name() string
	New(cfg *viper.Viper, path string) (zapcore.Core, error)
}

CoreFactory is zap core factory.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL