Skip to content

Latest commit

 

History

History
49 lines (36 loc) · 1.3 KB

README.md

File metadata and controls

49 lines (36 loc) · 1.3 KB

loggers-mapper-newrelic

Golang Loggers mapper for New Relic.

GoDoc Build Status

Pre-recquisite

See https://gopkg.in/birkirb/loggers.v1

Installation

go get github.com/adamhassel/loggers-mapper-newrelic

Usage

Assuming you are using loggers in your code, and you want to use loggers for New Relic. Start by configuring your loggers, and then pass it to the mapper and assign it as NewRelic's loggers interface.

Example

package main

import (
	"os"

    "gopkg.in/birkirb/loggers.v1"
	newrelic "github.com/newrelic/go-agent"
    nrlog "github.com/adamhassel/loggers-mapper-newrelic"
)

// Log is my default logger.
var Log loggers.Contextual

func main() {
	var debug bool
	if testing {
		debug = true
	}
	config := newrelic.NewConfig("myappname", license)
	logger := nrlog.NewLogger(Log, debug, true)
	config.Logger = logger
	app, err = newrelic.NewApplication(config)
	if err != nil {
		panic(err)
	}
	// ... do new relic transactions
}