Skip to content

Integration between birkirb/loggers and NewRelic

License

Notifications You must be signed in to change notification settings

Vivino/go-loggers-mapper-newrelic

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
}

About

Integration between birkirb/loggers and NewRelic

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%