nrwriter

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2022 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogWriter

type LogWriter struct {
	// contains filtered or unexported fields
}

LogWriter is an io.Writer that captures log data for use with New Relic Logs in Context

func New

func New(output io.Writer, app *newrelic.Application) LogWriter

New creates a new NewRelicWriter Object output is the io.Writer destination that you want your log to be written to app must be a vaild, non nil new relic Application

func (*LogWriter) DebugLogging

func (b *LogWriter) DebugLogging(enabled bool)

DebugLogging enables or disables debug error messages being written in the IO output. By default, the nrwriter debug logging is set to false and will fail silently

func (*LogWriter) EnrichLog

func (b *LogWriter) EnrichLog(data newrelic.LogData, p []byte) []byte

EnrichLog attempts to enrich a log with New Relic linking metadata. If it fails, it will return the original log line unless debug=true, otherwise it will print an error on a following line.

func (*LogWriter) WithContext

func (b *LogWriter) WithContext(ctx context.Context) LogWriter

WithTransaction duplicates the current NewRelicWriter and sets the transaction to the transaction parsed from ctx

func (*LogWriter) WithTransaction

func (b *LogWriter) WithTransaction(txn *newrelic.Transaction) LogWriter

WithTransaction duplicates the current NewRelicWriter and sets the transaction to txn

func (LogWriter) Write

func (b LogWriter) Write(p []byte) (n int, err error)

Write implements io.Write

Jump to

Keyboard shortcuts

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