logger

package
v2.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package logger provides logger for Easegress.

Index

Constants

View Source
const (

	// EtcdClientFilename is the filename of etcd client log.
	EtcdClientFilename = "etcd_client.log"
)

Variables

This section is empty.

Functions

func APIAccess

func APIAccess(
	method, remoteAddr, path string,
	code int,
	bodyBytedReceived, bodyBytesSent int64,
	requestTime time.Time,
	processTime time.Duration)

APIAccess logs admin api log.

func Debugf

func Debugf(template string, args ...interface{})

Debugf is the wrapper of default logger Debugf.

func Errorf

func Errorf(template string, args ...interface{})

Errorf is the wrapper of default logger Errorf.

func EtcdClientLoggerConfig

func EtcdClientLoggerConfig(opt *option.Options, filename string) *zap.Config

EtcdClientLoggerConfig generates the config of etcd client logger.

func GetLogLevel added in v2.6.3

func GetLogLevel() string

GetLogLevel returns log level.

func GetLogPath added in v2.6.1

func GetLogPath() string

GetLogPath returns the path of stdout log.

func HTTPAccess

func HTTPAccess(template string, args ...interface{})

HTTPAccess logs http access log.

func Infof

func Infof(template string, args ...interface{})

Infof is the wrapper of default logger Infof.

func Init

func Init(opt *option.Options)

Init initializes logger.

func InitMock

func InitMock()

InitMock initializes all logger to print stdout, mainly for unit testing

func InitNop

func InitNop()

InitNop initializes all logger as nop, mainly for unit testing

func LazyDebug

func LazyDebug(fn func() string)

LazyDebug logs debug log in lazy mode. if debug log is disabled by configuration, it skips the the built of log message to improve performance

func LazyHTTPAccess

func LazyHTTPAccess(fn func() string)

LazyHTTPAccess logs http access log in lazy mode, if http access log is disabled by configuration, it skips the the built of log message to improve performance

func MustNewPlainLogger added in v2.7.1

func MustNewPlainLogger(opt *option.Options, filename string, maxCacheCount uint32) *zap.SugaredLogger

MustNewPlainLogger creates a plain logger, it panics if any error occurs.

func NginxHTTPAccess

func NginxHTTPAccess(remoteAddr, proto, method, path, referer, agent, realIP string,
	code int, bodyBytesSent int64,
	requestTime time.Duration, upstreamResponseTime time.Duration,
	upstreamAddr string, upstreamCode int, clientWriteBodyTime, clientReadBodyTime,
	routeTime time.Duration)

NginxHTTPAccess is DEPRECATED, replaced by HTTPAccess.

func SetLogLevel added in v2.6.3

func SetLogLevel(level zapcore.Level)

SetLogLevel sets log level. Only support debug and info.

func SpanDebugf

func SpanDebugf(context *model.SpanContext, template string, args ...interface{})

SpanDebugf is the wrapper of default logger Debugf to log tracing message

func SpanErrorf

func SpanErrorf(context *model.SpanContext, template string, args ...interface{})

SpanErrorf is the wrapper of default logger Debugf to log tracing message

func Sync

func Sync()

Sync syncs all logs, must be called after calling Init().

func Warnf

func Warnf(template string, args ...interface{})

Warnf is the wrapper of default logger Warnf.

Types

This section is empty.

Jump to

Keyboard shortcuts

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