cdslog

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: BSD-3-Clause Imports: 13 Imported by: 50

Documentation

Index

Constants

View Source
const (
	// If you add a field constant, don't forget to add it in the log.RegisterField below
	Action             = log.Field("action")
	AuthConsumerID     = log.Field("auth_consumer_id")
	AuthServiceName    = log.Field("auth_service_name")
	AuthServiceType    = log.Field("auth_service_type")
	AuthSessionIAT     = log.Field("auth_session_iat")
	AuthSessionID      = log.Field("auth_session_id")
	AuthSessionTokenID = log.Field("auth_session_token")
	AuthUserID         = log.Field("auth_user_id")
	AuthUsername       = log.Field("auth_user_name")
	AuthWorkerName     = log.Field("auth_worker_name")
	RbackCheckerName   = log.Field("rbac_checker_name")
	Commit             = log.Field("commit")
	Deprecated         = log.Field("deprecated")
	Duration           = log.Field("duration_milliseconds_num")
	Goroutine          = log.Field("goroutine")
	Handler            = log.Field("handler")
	IPAddress          = log.Field("ip_address")
	Latency            = log.Field("latency")
	LatencyNum         = log.Field("latency_num")
	Method             = log.Field("method")
	GpgKey             = log.Field("gpg_key")
	RequestID          = log.Field("request_id")
	RequestURI         = log.Field("request_uri")
	Repository         = log.Field("repository")
	Operation          = log.Field("operation")
	Route              = log.Field("route")
	Service            = log.Field("service")
	Size               = log.Field("size_num")
	Stacktrace         = log.Field("stack_trace")
	Status             = log.Field("status")
	StatusNum          = log.Field("status_num")
	Sudo               = log.Field("sudo")
	VCSServer          = log.Field("vcs_server")
	KafkaBroker        = log.Field("kafka_broker")
	KafkaTopic         = log.Field("kafka_topic")
)
View Source
const (
	HeaderRequestID      = "Request-ID"
	ExtraFieldSignature  = "Signature"
	ExtraFieldLine       = "Line"
	ExtraFieldTerminated = "Terminated"
)

Variables

This section is empty.

Functions

func ContextValue

func ContextValue(ctx context.Context, f log.Field) string

func Flush

func Flush(ctx context.Context, l *logrus.Logger)

For given logrus logger, try to flush hooks

func Initialize

func Initialize(ctx context.Context, conf *Conf)

Initialize init log level

func New

func New(ctx context.Context, graylogcfg *hook.Config) (*logrus.Logger, *hook.Hook, error)

func ReplaceAllHooks

func ReplaceAllHooks(ctx context.Context, l *logrus.Logger, graylogcfg *hook.Config) error

Types

type CDSFormatter

type CDSFormatter struct{}

CDSFormatter ...

func (*CDSFormatter) Format

func (f *CDSFormatter) Format(entry *logrus.Entry) ([]byte, error)

Format format a log

type Conf

type Conf struct {
	Level                      string
	Format                     string
	GraylogHost                string
	GraylogPort                string
	GraylogProtocol            string
	GraylogExtraKey            string
	GraylogExtraValue          string
	GraylogFieldCDSServiceType string
	GraylogFieldCDSServiceName string
	GraylogFieldCDSVersion     string
	GraylogFieldCDSOS          string
	GraylogFieldCDSArch        string
}

Conf contains log configuration

type Message

type Message struct {
	Value     string
	Level     logrus.Level
	Signature cdn.Signature
}

func (Message) ServiceKey

func (m Message) ServiceKey() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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