forked from newrelic/go-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
log.go
43 lines (37 loc) · 1.55 KB
/
log.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright 2020 New Relic Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package newrelic
import (
"io"
"github.com/Easypay/go-agent/v3/internal/logger"
)
// Logger is the interface that is used for logging in the Go Agent. Assign
// the Config.Logger field to the Logger you wish to use. Loggers must be safe
// for use in multiple goroutines. Two Logger implementations are included:
// NewLogger, which logs at info level, and NewDebugLogger which logs at debug
// level. logrus, logxi, and zap are supported by the integration packages
// https://godoc.org/github.com/Easypay/go-agent/v3/integrations/nrlogrus,
// https://godoc.org/github.com/Easypay/go-agent/v3/integrations/nrlogxi,
// and https://godoc.org/github.com/Easypay/go-agent/v3/integrations/nrzap
// respectively.
type Logger interface {
Error(msg string, context map[string]interface{})
Warn(msg string, context map[string]interface{})
Info(msg string, context map[string]interface{})
Debug(msg string, context map[string]interface{})
DebugEnabled() bool
}
// NewLogger creates a basic Logger at info level.
//
// Deprecated: NewLogger is deprecated and will be removed in a future release.
// Use the ConfigInfoLogger ConfigOption instead.
func NewLogger(w io.Writer) Logger {
return logger.New(w, false)
}
// NewDebugLogger creates a basic Logger at debug level.
//
// Deprecated: NewDebugLogger is deprecated and will be removed in a future
// release. Use the ConfigDebugLogger ConfigOption instead.
func NewDebugLogger(w io.Writer) Logger {
return logger.New(w, true)
}