Documentation ¶
Overview ¶
Package log provides logging utilities for the tracer.
Index ¶
- Constants
- func Debug(fmt string, a ...interface{})
- func DebugEnabled() bool
- func Error(format string, a ...interface{})
- func Flush()
- func Info(fmt string, a ...interface{})
- func SetLevel(lvl Level)
- func UseLogger(l Logger) (undo func())
- func Warn(fmt string, a ...interface{})
- type DiscardLogger
- type Level
- type Logger
- type ManagedFile
- type RecordLogger
Constants ¶
const LoggerFile = "ddtrace.log"
File name for writing tracer logs, if DD_TRACE_LOG_DIRECTORY has been configured
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(fmt string, a ...interface{})
Debug prints the given message if the level is LevelDebug.
func DebugEnabled ¶ added in v1.37.0
func DebugEnabled() bool
DebugEnabled returns true if debug log messages are enabled. This can be used in extremely hot code paths to avoid allocating the ...interface{} argument.
func Error ¶
func Error(format string, a ...interface{})
Error reports an error. Errors get aggregated and logged periodically. The default is once per minute or once every DD_LOGGING_RATE number of seconds.
func Info ¶ added in v1.26.0
func Info(fmt string, a ...interface{})
Info prints an informational message.
Types ¶
type DiscardLogger ¶ added in v1.31.1
type DiscardLogger struct{}
DiscardLogger discards every call to Log().
func (DiscardLogger) Log ¶ added in v1.31.1
func (d DiscardLogger) Log(_ string)
Log implements Logger.
type Logger ¶ added in v1.43.0
type Logger interface { // Log prints the given message. Log(msg string) }
Logger implementations are able to log given messages that the tracer might output. This interface is duplicated here to avoid a cyclic dependency between this package and ddtrace
type ManagedFile ¶ added in v1.70.0
type ManagedFile struct {
// contains filtered or unexported fields
}
ManagedFile functions like a *os.File but is safe for concurrent use
func OpenFileAtPath ¶ added in v1.70.0
func OpenFileAtPath(dirPath string) (*ManagedFile, error)
OpenFileAtPath creates a new file at the specified dirPath and configures the logger to write to this file. The dirPath must already exist on the underlying os. It returns the file that was created, or nil and an error if the file creation was unsuccessful. The caller of OpenFileAtPath is responsible for calling Close() on the ManagedFile
func (*ManagedFile) Close ¶ added in v1.70.0
func (m *ManagedFile) Close() error
Close closes the ManagedFile's *os.File in a concurrent-safe manner, ensuring the file is closed only once
func (*ManagedFile) Name ¶ added in v1.70.0
func (m *ManagedFile) Name() string
type RecordLogger ¶ added in v1.31.1
type RecordLogger struct {
// contains filtered or unexported fields
}
RecordLogger records every call to Log() and makes it available via Logs().
func (*RecordLogger) Ignore ¶ added in v1.49.0
func (r *RecordLogger) Ignore(substrings ...string)
Ignore adds substrings to the ignore field of RecordLogger, allowing the RecordLogger to ignore attempts to log strings with certain substrings.
func (*RecordLogger) Log ¶ added in v1.31.1
func (r *RecordLogger) Log(msg string)
Log implements Logger.
func (*RecordLogger) Logs ¶ added in v1.31.1
func (r *RecordLogger) Logs() []string
Logs returns the ordered list of logs recorded by the logger.
func (*RecordLogger) Reset ¶ added in v1.47.0
func (r *RecordLogger) Reset()
Reset resets the logger's internal logs