You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-07-15 01:04:25 +02:00
Removed unused func, added doc strings
This commit is contained in:
@ -15,11 +15,7 @@
|
|||||||
package debug // import "go.opentelemetry.io/otel/debug"
|
package debug // import "go.opentelemetry.io/otel/debug"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
|
||||||
"os"
|
|
||||||
|
|
||||||
"github.com/go-logr/logr"
|
"github.com/go-logr/logr"
|
||||||
"github.com/go-logr/stdr"
|
|
||||||
|
|
||||||
"go.opentelemetry.io/otel/internal/debug"
|
"go.opentelemetry.io/otel/internal/debug"
|
||||||
)
|
)
|
||||||
@ -28,9 +24,3 @@ import (
|
|||||||
func SetLogger(logger logr.Logger) {
|
func SetLogger(logger logr.Logger) {
|
||||||
debug.Log = logger
|
debug.Log = logger
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetDefaultLogger configures the internal logger to use stderr and show verbose logging messages.
|
|
||||||
func SetDefaultLogger() {
|
|
||||||
SetLogger(stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile)))
|
|
||||||
stdr.SetVerbosity(5)
|
|
||||||
}
|
|
||||||
|
@ -22,20 +22,32 @@ import (
|
|||||||
"github.com/go-logr/stdr"
|
"github.com/go-logr/stdr"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// globalLogger is the logging interface used within the otel api and sdk provide deatails of the internals.
|
||||||
|
//
|
||||||
|
// The default logger uses stdr which is backed by the standard `log.Logger`
|
||||||
|
// interface. This logger will only show messages at the Error Level.
|
||||||
var globalLoggger logr.Logger = stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile))
|
var globalLoggger logr.Logger = stdr.New(log.New(os.Stderr, "", log.LstdFlags|log.Lshortfile))
|
||||||
|
|
||||||
|
// SetLogger overrides the globalLogger with l.
|
||||||
|
//
|
||||||
|
// To see Info messages use a logger with `l.V(1).Enabled() == true`
|
||||||
|
// To see Debug messages use a logger with `l.V(5).Enabled() == true`
|
||||||
func SetLogger(l logr.Logger) {
|
func SetLogger(l logr.Logger) {
|
||||||
globalLoggger = l
|
globalLoggger = l
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Info prints messages about the general state of the API or SDK.
|
||||||
|
// This should usually be less then 5 messages a minute
|
||||||
func Info(msg string, keysAndValues ...interface{}) {
|
func Info(msg string, keysAndValues ...interface{}) {
|
||||||
globalLoggger.V(1).Info(msg, keysAndValues...)
|
globalLoggger.V(1).Info(msg, keysAndValues...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Error prints messages about exceptional states of the API or SDK.
|
||||||
func Error(err error, msg string, keysAndValues ...interface{}) {
|
func Error(err error, msg string, keysAndValues ...interface{}) {
|
||||||
globalLoggger.Error(err, msg, keysAndValues...)
|
globalLoggger.Error(err, msg, keysAndValues...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Debug prints messages about all internal changes in the API or SDK.
|
||||||
func Debug(msg string, keysAndValues ...interface{}) {
|
func Debug(msg string, keysAndValues ...interface{}) {
|
||||||
globalLoggger.V(5).Info(msg, keysAndValues...)
|
globalLoggger.V(5).Info(msg, keysAndValues...)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user