Documentation ¶
Index ¶
- Variables
- func ConvertMaxSize(maxSize int) int
- func Debug(args ...interface{})
- func DebugRedacted(redactedFields []string, args ...interface{})
- func Debugf(format string, args ...interface{})
- func DeprecationWarningDoc(old string, docRef string)
- func DeprecationWarningReplace(old string, new string)
- func Error(args ...interface{})
- func ErrorRedacted(redactedFields []string, args ...interface{})
- func Errorf(format string, args ...interface{})
- func Get() *logrus.Logger
- func GetLevel() logrus.Level
- func GetMetricLogger() *logrus.Logger
- func GetUsageLogger() *logrus.Logger
- func Info(args ...interface{})
- func InfoRedacted(redactedFields []string, args ...interface{})
- func Infof(format string, args ...interface{})
- func IsHTTPLogTraceEnabled() bool
- func NewRequestWithTraceContext(id string, req *http.Request) *http.Request
- func ObscureArguments(redactedFields []string, args ...interface{}) []interface{}
- func RegisterContextField(ctxFields ...ContextField)
- func SetIsLogP()
- func SetLevel(level logrus.Level)
- func Trace(args ...interface{})
- func TraceRedacted(redactedFields []string, args ...interface{})
- func Tracef(format string, args ...interface{})
- func UnsetIsLogP()
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- type ContextField
- type FieldLogger
- func NewFieldLogger() FieldLogger
- func NewFieldLoggerEntry(l *logrus.Logger, isLogP bool) FieldLogger
- func NewLoggerFromContext(ctx context.Context) FieldLogger
- func NewMetricFieldLogger() FieldLogger
- func NewUsageFieldLogger() FieldLogger
- func UpdateLoggerWithContext(ctx context.Context, logger FieldLogger) FieldLogger
- type LoggerConfig
- func (b *LoggerConfig) Apply() error
- func (b *LoggerConfig) Filename(filename string) *LoggerConfig
- func (b *LoggerConfig) Format(format string) *LoggerConfig
- func (b *LoggerConfig) GetLevel() string
- func (b *LoggerConfig) Level(level string) *LoggerConfig
- func (b *LoggerConfig) MaxAge(maxAge int) *LoggerConfig
- func (b *LoggerConfig) MaxBackups(maxBackups int) *LoggerConfig
- func (b *LoggerConfig) MaxMetricAge(maxAge int) *LoggerConfig
- func (b *LoggerConfig) MaxMetricBackups(maxBackups int) *LoggerConfig
- func (b *LoggerConfig) MaxMetricSize(maxSize int) *LoggerConfig
- func (b *LoggerConfig) MaxSize(maxSize int) *LoggerConfig
- func (b *LoggerConfig) MaxUsageAge(maxAge int) *LoggerConfig
- func (b *LoggerConfig) MaxUsageBackups(maxBackups int) *LoggerConfig
- func (b *LoggerConfig) MaxUsageSize(maxSize int) *LoggerConfig
- func (b *LoggerConfig) MetricFilename(filename string) *LoggerConfig
- func (b *LoggerConfig) Metrics(enabled bool) *LoggerConfig
- func (b *LoggerConfig) Output(output string) *LoggerConfig
- func (b *LoggerConfig) Path(path string) *LoggerConfig
- func (b *LoggerConfig) Usage(enabled bool) *LoggerConfig
- func (b *LoggerConfig) UsageFilename(filename string) *LoggerConfig
- type LoggingFormat
- type LoggingOutput
- type Redactor
- type StdLogger
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidLogConfig = configerrors.Newf(1410, "logging configuration error - %v does not meet criteria (%v)")
)
Log Config Errors
Functions ¶
func ConvertMaxSize ¶ added in v1.1.89
ConvertMaxSize - takes max size in bytes and returns in megabytes for the rotate file hook
func DebugRedacted ¶
func DebugRedacted(redactedFields []string, args ...interface{})
DebugRedacted Redacted log for debugging
func DeprecationWarningDoc ¶
DeprecationWarningDoc - log a deprecation warning with the old and replaced usage
func DeprecationWarningReplace ¶
DeprecationWarningReplace - log a deprecation warning with the old and replaced usage
func ErrorRedacted ¶
func ErrorRedacted(redactedFields []string, args ...interface{})
ErrorRedacted Redacted log for errors
func GetMetricLogger ¶ added in v1.1.80
GetMetricLogger returns the metric logger
func GetUsageLogger ¶ added in v1.1.83
func InfoRedacted ¶
func InfoRedacted(redactedFields []string, args ...interface{})
InfoRedacted Redacted log for information
func NewRequestWithTraceContext ¶
NewRequestWithTraceContext - New request trace context
func ObscureArguments ¶
func ObscureArguments(redactedFields []string, args ...interface{}) []interface{}
ObscureArguments obscure/mask/redact values for a set of trailing arguments
func RegisterContextField ¶ added in v1.1.44
func RegisterContextField(ctxFields ...ContextField)
func TraceRedacted ¶
func TraceRedacted(redactedFields []string, args ...interface{})
TraceRedacted Redacted log for traces
Types ¶
type ContextField ¶ added in v1.1.44
type ContextField string
const ( KindCtx ContextField = "kind" NameCtx ContextField = "name" )
type FieldLogger ¶
type FieldLogger interface { StdLogger WithField(key string, value interface{}) FieldLogger WithFields(fields logrus.Fields) FieldLogger WithError(err error) FieldLogger WithComponent(componentName string) FieldLogger WithPackage(packageName string) FieldLogger }
FieldLogger Wraps the StdLogger, and provides logrus methods for logging with fields. Intended to mimic the logrus.FieldLogger interface, but with our own interface and implementation.
func NewFieldLogger ¶
func NewFieldLogger() FieldLogger
NewFieldLogger returns a FieldLogger for standard logging, and logp logging.
func NewFieldLoggerEntry ¶ added in v1.1.80
func NewFieldLoggerEntry(l *logrus.Logger, isLogP bool) FieldLogger
NewFieldLoggerEntry returns a FieldLogger for standard logging, and logp logging.
func NewLoggerFromContext ¶ added in v1.1.44
func NewLoggerFromContext(ctx context.Context) FieldLogger
NewLoggerFromContext returns a FieldLogger for standard logging, and logp logging.
func NewMetricFieldLogger ¶ added in v1.1.80
func NewMetricFieldLogger() FieldLogger
NewFieldLogger returns a FieldLogger for standard logging, and logp logging.
func NewUsageFieldLogger ¶ added in v1.1.83
func NewUsageFieldLogger() FieldLogger
NewFieldLogger returns a FieldLogger for standard logging, and logp logging.
func UpdateLoggerWithContext ¶ added in v1.1.44
func UpdateLoggerWithContext(ctx context.Context, logger FieldLogger) FieldLogger
UpdateLoggerWithContext returns a FieldLogger for standard logging, and logp logging.
type LoggerConfig ¶
type LoggerConfig struct {
// contains filtered or unexported fields
}
LoggerConfig - is a builder used to setup the logging for an agent
var GlobalLoggerConfig LoggerConfig
GlobalLoggerConfig - is the default config of the logger
func (*LoggerConfig) Apply ¶
func (b *LoggerConfig) Apply() error
Apply - applies the config changes to the logger
func (*LoggerConfig) Filename ¶
func (b *LoggerConfig) Filename(filename string) *LoggerConfig
Filename -
func (*LoggerConfig) Format ¶
func (b *LoggerConfig) Format(format string) *LoggerConfig
Format - sets the logger formatt
func (*LoggerConfig) GetLevel ¶
func (b *LoggerConfig) GetLevel() string
GetLevel - returns current log level
func (*LoggerConfig) Level ¶
func (b *LoggerConfig) Level(level string) *LoggerConfig
Level - sets the logger level
func (*LoggerConfig) MaxBackups ¶
func (b *LoggerConfig) MaxBackups(maxBackups int) *LoggerConfig
MaxBackups -
func (*LoggerConfig) MaxMetricAge ¶ added in v1.1.80
func (b *LoggerConfig) MaxMetricAge(maxAge int) *LoggerConfig
MaxAge -
func (*LoggerConfig) MaxMetricBackups ¶ added in v1.1.80
func (b *LoggerConfig) MaxMetricBackups(maxBackups int) *LoggerConfig
MaxMetricBackups -
func (*LoggerConfig) MaxMetricSize ¶ added in v1.1.80
func (b *LoggerConfig) MaxMetricSize(maxSize int) *LoggerConfig
MaxMetricSize -
func (*LoggerConfig) MaxUsageAge ¶ added in v1.1.83
func (b *LoggerConfig) MaxUsageAge(maxAge int) *LoggerConfig
func (*LoggerConfig) MaxUsageBackups ¶ added in v1.1.83
func (b *LoggerConfig) MaxUsageBackups(maxBackups int) *LoggerConfig
func (*LoggerConfig) MaxUsageSize ¶ added in v1.1.83
func (b *LoggerConfig) MaxUsageSize(maxSize int) *LoggerConfig
func (*LoggerConfig) MetricFilename ¶ added in v1.1.80
func (b *LoggerConfig) MetricFilename(filename string) *LoggerConfig
Filename -
func (*LoggerConfig) Metrics ¶ added in v1.1.80
func (b *LoggerConfig) Metrics(enabled bool) *LoggerConfig
func (*LoggerConfig) Output ¶
func (b *LoggerConfig) Output(output string) *LoggerConfig
Output - sets how the logs will be tracked
func (*LoggerConfig) Usage ¶ added in v1.1.83
func (b *LoggerConfig) Usage(enabled bool) *LoggerConfig
func (*LoggerConfig) UsageFilename ¶ added in v1.1.83
func (b *LoggerConfig) UsageFilename(filename string) *LoggerConfig
type LoggingFormat ¶
type LoggingFormat int
LoggingFormat - Defines the format of the logging output
const ( // Line - logs individual lines, preceded by the timestamp and level Line LoggingFormat = iota + 1 // JSON - logs in JSON format with the timestamp, level, and message all being separate fields JSON )
type LoggingOutput ¶
type LoggingOutput int
LoggingOutput - Defines how the logger will log its output
const ( // STDOUT - logs to the standard output of the agent process STDOUT LoggingOutput = iota // File - logs to a file, configure file settings for more options File // Both - logs to stdout and file, see the file confugration settings Both )
type Redactor ¶
type Redactor interface { DebugRedacted(fields []string, args ...interface{}) ErrorRedacted(fields []string, args ...interface{}) InfoRedacted(fields []string, args ...interface{}) TraceRedacted(fields []string, args ...interface{}) }
Redactor interface for redacting log messages
type StdLogger ¶
type StdLogger interface { Redactor logrus.StdLogger Debug(args ...interface{}) Debugf(format string, args ...interface{}) Debugln(args ...interface{}) Error(args ...interface{}) Errorf(format string, args ...interface{}) Errorln(args ...interface{}) Info(args ...interface{}) Infof(format string, args ...interface{}) Infoln(args ...interface{}) Warn(args ...interface{}) Warnf(format string, args ...interface{}) Warnln(args ...interface{}) Trace(args ...interface{}) Tracef(format string, args ...interface{}) Traceln(args ...interface{}) }
StdLogger interface for logging methods found in the go standard library logger, and logrus methods.