log

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitFromConfig

func InitFromConfig(
	loggerPrefixName, moduleName string,
	logLevel int,
	isStdout bool,
	isJson bool,
	logLocation string,
	rotateCount uint,
	rotationTime uint,
) error

InitFromConfig initializes a Zap-based logger.

func ZDebug

func ZDebug(ctx context.Context, msg string, keysAndValues ...interface{})

func ZError

func ZError(ctx context.Context, msg string, err error, keysAndValues ...interface{})

func ZInfo

func ZInfo(ctx context.Context, msg string, keysAndValues ...interface{})

func ZWarn

func ZWarn(ctx context.Context, msg string, err error, keysAndValues ...interface{})

Types

type Color

type Color uint8

Color represents a text color.

const (
	Black Color = iota + 30
	Red
	Green
	Yellow
	Blue
	Magenta
	Cyan
	White
)

Foreground colors.

func (Color) Add

func (c Color) Add(s string) string

Add adds the coloring to the given string.

type Logger

type Logger interface {
	Debug(ctx context.Context, msg string, keysAndValues ...interface{})
	Info(ctx context.Context, msg string, keysAndValues ...interface{})
	Warn(ctx context.Context, msg string, err error, keysAndValues ...interface{})
	Error(ctx context.Context, msg string, err error, keysAndValues ...interface{})
	WithValues(keysAndValues ...interface{}) Logger
	WithName(name string) Logger
	WithCallDepth(depth int) Logger
}

type SqlLogger

type SqlLogger struct {
	LogLevel                  gormLogger.LogLevel
	IgnoreRecordNotFoundError bool
	SlowThreshold             time.Duration
}

func NewSqlLogger

func NewSqlLogger(logLevel gormLogger.LogLevel, ignoreRecordNotFoundError bool, slowThreshold time.Duration) *SqlLogger

func (SqlLogger) Error

func (SqlLogger) Error(ctx context.Context, msg string, args ...interface{})

func (SqlLogger) Info

func (SqlLogger) Info(ctx context.Context, msg string, args ...interface{})

func (*SqlLogger) LogMode

func (l *SqlLogger) LogMode(logLevel gormLogger.LogLevel) gormLogger.Interface

func (*SqlLogger) Trace

func (l *SqlLogger) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error)

func (SqlLogger) Warn

func (SqlLogger) Warn(ctx context.Context, msg string, args ...interface{})

type ZapLogger

type ZapLogger struct {
	// contains filtered or unexported fields
}

func NewZapLogger

func NewZapLogger(
	loggerPrefixName, loggerName string,
	logLevel int,
	isStdout bool,
	isJson bool,
	logLocation string,
	rotateCount uint,
	rotationTime uint,
) (*ZapLogger, error)

func (*ZapLogger) Debug

func (l *ZapLogger) Debug(ctx context.Context, msg string, keysAndValues ...interface{})

func (*ZapLogger) Error

func (l *ZapLogger) Error(ctx context.Context, msg string, err error, keysAndValues ...interface{})

func (*ZapLogger) Info

func (l *ZapLogger) Info(ctx context.Context, msg string, keysAndValues ...interface{})

func (*ZapLogger) ToZap

func (l *ZapLogger) ToZap() *zap.SugaredLogger

func (*ZapLogger) Warn

func (l *ZapLogger) Warn(ctx context.Context, msg string, err error, keysAndValues ...interface{})

func (*ZapLogger) WithCallDepth

func (l *ZapLogger) WithCallDepth(depth int) Logger

func (*ZapLogger) WithName

func (l *ZapLogger) WithName(name string) Logger

func (*ZapLogger) WithValues

func (l *ZapLogger) WithValues(keysAndValues ...interface{}) Logger

type ZkLogger

type ZkLogger struct{}

func NewZkLogger

func NewZkLogger() *ZkLogger

func (*ZkLogger) Printf

func (l *ZkLogger) Printf(format string, a ...interface{})

Jump to

Keyboard shortcuts

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