go-agent: github.com/newrelic/go-agent/v3/integrations/nrzap Index | Examples | Files

package nrzap

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

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

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

Code:

// 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")),
)

Index

Examples

Package Files

nrzap.go

func ConfigLogger Uses

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

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

func Transform Uses

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

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

Package nrzap imports 3 packages (graph). Updated 2020-01-15. Refresh now. Tools for package owners.