github.com/newrelic/go-agent@v3.26.0+incompatible/_integrations/nrlogxi/v1/example_test.go (about)

     1  // Copyright 2020 New Relic Corporation. All rights reserved.
     2  // SPDX-License-Identifier: Apache-2.0
     3  
     4  package nrlogxi_test
     5  
     6  import (
     7  	log "github.com/mgutz/logxi/v1"
     8  	newrelic "github.com/newrelic/go-agent"
     9  	nrlogxi "github.com/newrelic/go-agent/_integrations/nrlogxi/v1"
    10  )
    11  
    12  func Example() {
    13  	cfg := newrelic.NewConfig("Example App", "__YOUR_NEWRELIC_LICENSE_KEY__")
    14  
    15  	// Create a new logxi logger:
    16  	l := log.New("newrelic")
    17  	l.SetLevel(log.LevelInfo)
    18  
    19  	// Use nrlogxi to register the logger with the agent:
    20  	cfg.Logger = nrlogxi.New(l)
    21  
    22  	newrelic.NewApplication(cfg)
    23  }