Documentation ¶
Index ¶
- Variables
- func WrapTransactionCore(core zapcore.Core, txn *newrelic.Transaction) (zapcore.Core, error)
- type NewRelicZapCore
- func (c *NewRelicZapCore) Check(entry zapcore.Entry, checkedEntry *zapcore.CheckedEntry) *zapcore.CheckedEntry
- func (c *NewRelicZapCore) Enabled(level zapcore.Level) bool
- func (c *NewRelicZapCore) Sync() error
- func (c *NewRelicZapCore) With(fields []zap.Field) zapcore.Core
- func (c *NewRelicZapCore) Write(entry zapcore.Entry, fields []zap.Field) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNilZapcore is an error caused by calling a WrapXCore function on a nil zapcore.Core object ErrNilZapcore = errors.New("cannot wrap nil zapcore.Core object") // ErrNilApp is an error caused by calling WrapBackgroundCore with a nil newrelic.Application ErrNilApp = errors.New("wrapped a zapcore.Core with a nil New Relic application; logs will not be captured") // ErrNilTxn is an error caused by calling WrapTransactionCore with a nil newrelic.Transaction ErrNilTxn = errors.New("wrapped a zapcore.Core with a nil New Relic transaction; logs will not be captured") )
Functions ¶
func WrapTransactionCore ¶
WrapTransactionCore creates a new NewRelicZapCore object, which is a wrapped zapcore.Core object. This wrapped object captures logs in context of a transaction and sends them to New Relic.
Errors will be returned if the zapcore object is nil, or if the application is nil. It is up to the user to decide how to handle the case where the newrelic.Transaction is nil. In the case that the newrelic.Application is nil, a valid NewRelicZapCore object will still be returned.
Types ¶
type NewRelicZapCore ¶
type NewRelicZapCore struct {
// contains filtered or unexported fields
}
NewRelicZapCore implements zap.Core
func WrapBackgroundCore ¶
func WrapBackgroundCore(core zapcore.Core, app *newrelic.Application) (*NewRelicZapCore, error)
NewBackgroundCore creates a new NewRelicZapCore object, which is a wrapped zapcore.Core object. This wrapped object captures background logs in context and sends them to New Relic.
Errors will be returned if the zapcore object is nil, or if the application is nil. It is up to the user to decide how to handle the case where the newrelic.Application is nil. In the case that the newrelic.Application is nil, a valid NewRelicZapCore object will still be returned.
func (*NewRelicZapCore) Check ¶
func (c *NewRelicZapCore) Check(entry zapcore.Entry, checkedEntry *zapcore.CheckedEntry) *zapcore.CheckedEntry
Check simply calls zapcore.Check on the Core object.
func (*NewRelicZapCore) Enabled ¶
func (c *NewRelicZapCore) Enabled(level zapcore.Level) bool
Enabled simply calls zapcore.Enabled on the zapcore.Level passed to it.
func (*NewRelicZapCore) Sync ¶
func (c *NewRelicZapCore) Sync() error
Sync simply calls zapcore.Sync on the Core object.
func (*NewRelicZapCore) With ¶
func (c *NewRelicZapCore) With(fields []zap.Field) zapcore.Core
With makes a copy of a NewRelicZapCore with new zap.Fields. It calls zapcore.With() on the zap core object then makes a deepcopy of the NewRelicApplicationState object so the original object can be deallocated when it's no longer in scope.