log

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultComponent = "kubehound"
)

Variables

This section is empty.

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/disbaled 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

var I *KubehoundLogger = Base()

Global logger instance for use through the app

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