log

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultComponent = "kubehound"
)

Variables

View Source
var I = Base()

I Global logger instance for use through the app

Functions

func AddGlobalTags

func AddGlobalTags(tags map[string]string)

AddGlobalTags adds global tags to all application loggers.

func SetDD

func SetDD(enabled bool)

SetDD enables/disabled Datadog integration in the logger.

Types

type KubehoundLogger

type KubehoundLogger struct {
	*logrus.Entry
}

Require our logger to append job or API related fields for easier filtering and parsing of logs within custom dashboards. Sticking to the "structured" log types also enables out of the box correlation of APM traces and log messages without the need for a custom index pipeline. See: https://docs.datadoghq.com/logs/log_collection/go/#configure-your-logger

func Base

func Base() *KubehoundLogger

Base returns the base logger for the application.

func Trace

func Trace(ctx context.Context, opts ...LoggerOption) *KubehoundLogger

Trace creates a logger from the current context, attaching trace and span IDs for use with APM.

type LoggerConfig

type LoggerConfig struct {
	Tags logrus.Fields // Tags applied to all logs.
	Mu   *sync.Mutex   // Lock to enable safe runtime changes.
	DD   bool          // Whether Datadog integration is enabled.
}

type LoggerOption

type LoggerOption func(*logrus.Entry) *logrus.Entry

func WithComponent

func WithComponent(name string) LoggerOption

WithComponent adds a component name tag to the logger.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL