nrzap

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2021 License: Apache-2.0 Imports: 3 Imported by: 8

README

v3/integrations/nrzap GoDoc

Package nrzap supports https://github.com/uber-go/zap.

import "github.com/newrelic/go-agent/v3/integrations/nrzap"

For more information, see godocs.

Documentation

Overview

Package nrzap supports https://github.com/uber-go/zap

Wrap your zap Logger using nrzap.Transform to send agent log messages to zap.

Example
package main

import (
	"github.com/newrelic/go-agent/v3/integrations/nrzap"
	"github.com/newrelic/go-agent/v3/newrelic"
	"go.uber.org/zap"
)

func main() {
	// Create a new zap logger:
	z, _ := zap.NewProduction()

	newrelic.NewApplication(
		newrelic.ConfigAppName("Example App"),
		newrelic.ConfigLicense("__YOUR_NEWRELIC_LICENSE_KEY__"),
		// Use nrzap to register the logger with the agent:
		nrzap.ConfigLogger(z.Named("newrelic")),
	)
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigLogger

func ConfigLogger(l *zap.Logger) newrelic.ConfigOption

ConfigLogger configures the newrelic.Application to send log messsages to the provided zap logger.

func Transform

func Transform(l *zap.Logger) newrelic.Logger

Transform turns a *zap.Logger into a newrelic.Logger.

Types

This section is empty.

Jump to

Keyboard shortcuts

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