log

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLoggerInContext

func AddLoggerInContext(ctx context.Context, l Logger) context.Context

func New

func New(host, token string, assync bool, zapLogger *zap.Logger) *splunk

func NewLogger added in v0.0.7

func NewLogger(environment string, vendor Vendor, zapLogger *zap.Logger) *logger

Types

type Logger added in v0.0.7

type Logger interface {
	Error(ctx context.Context, err error, data any)
}

func GetLoggerFromContext added in v0.0.7

func GetLoggerFromContext(ctx context.Context) Logger

type Metadata added in v0.0.7

type Metadata struct {
	LogLevel logLevel `json:"logLevel,omitempty"`
	Data     any      `json:"data,omitempty"`
	Message  string   `json:"message,omitempty"`
	Request  Request  `json:"request"`
}

type Request

type Request struct {
	RequestID string      `json:"requestId,omitempty"`
	Host      string      `json:"host"`
	UserAgent string      `json:"userAgent,omitempty"`
	IP        string      `json:"ip"`
	Method    string      `json:"method"`
	Endpoint  string      `json:"endpoint"`
	Headers   http.Header `json:"headers"`
}

type Vendor added in v0.0.7

type Vendor interface {
	Send(ctx context.Context, payload []byte)
}

Jump to

Keyboard shortcuts

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