zbark

package
v0.0.0-...-c13599a Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2016 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package zbark provides a wrapper to make zap.Loggers compatible with the bark.Logger interface.

This package is only of interest to users of github.com/uber-common/bark.

Example
package main

import (
	"github.com/uber-go/zap"
	"github.com/uber-go/zap/zbark"
)

func main() {
	zapLogger := zap.NewJSON()
	// Stub the current time in tests.
	zapLogger.StubTime()

	// Wrap our structured logger to mimic bark.Logger.
	logger := zbark.Barkify(zapLogger)

	// The wrapped logger has bark's usual fluent API.
	logger.WithField("errors", 0).Infof("%v accepts arbitrary types.", "Bark")

}
Output:

{"msg":"Bark accepts arbitrary types.","level":"info","ts":0,"fields":{"errors":0}}

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Barkify

func Barkify(l zap.Logger) bark.Logger

Barkify wraps zap's JSON logger to make it compatible with the bark.Logger interface.

Types

This section is empty.

Jump to

Keyboard shortcuts

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