logger

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

README

logger

Documentation

Index

Constants

View Source
const (
	Development = "development"
	Production  = "production"
	RequestKey  = "request_id"
	UserKey     = "user_id"
	ServerName  = "rhino_logger"
	Version     = "v1.0.0"
)

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, fields ...zap.Field)

func DebugCtx

func DebugCtx(ctx context.Context, msg string, fields ...zap.Field)

func Error

func Error(msg string, err error, fields ...zap.Field)

func ErrorCtx

func ErrorCtx(ctx context.Context, msg string, err error, fields ...zap.Field)

func Fatal

func Fatal(msg string, fields ...zap.Field)

func FatalCtx

func FatalCtx(ctx context.Context, msg string, fields ...zap.Field)

func Info

func Info(msg string, fields ...zap.Field)

func InfoCtx

func InfoCtx(ctx context.Context, msg string, fields ...zap.Field)

func Init

func Init(opts ...Option) error

func InitDevelopment

func InitDevelopment() error

func InitProduction

func InitProduction() error

func Sync

func Sync() error

func Trace

func Trace(ctx context.Context, funcName string) func()

func Warn

func Warn(msg string, fields ...zap.Field)

func WarnCtx

func WarnCtx(ctx context.Context, msg string, fields ...zap.Field)

Types

type Logger

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

func New

func New(opts ...Option) (*Logger, error)

func NewDevelopment

func NewDevelopment() (*Logger, error)

func NewProduction

func NewProduction() (*Logger, error)

func With

func With(fields ...zap.Field) *Logger

func WithContext

func WithContext(ctx context.Context) *Logger

func (*Logger) Debug

func (l *Logger) Debug(msg string, fields ...zap.Field)

func (*Logger) DebugCtx added in v0.0.2

func (l *Logger) DebugCtx(ctx context.Context, msg string, fields ...zap.Field)

func (*Logger) Error

func (l *Logger) Error(msg string, err error, fields ...zap.Field)

func (*Logger) ErrorCtx added in v0.0.2

func (l *Logger) ErrorCtx(ctx context.Context, msg string, err error, fields ...zap.Field)

func (*Logger) Fatal

func (l *Logger) Fatal(msg string, fields ...zap.Field)

func (*Logger) FatalCtx added in v0.0.2

func (l *Logger) FatalCtx(ctx context.Context, msg string, fields ...zap.Field)

func (*Logger) Info

func (l *Logger) Info(msg string, fields ...zap.Field)

func (*Logger) InfoCtx added in v0.0.2

func (l *Logger) InfoCtx(ctx context.Context, msg string, fields ...zap.Field)

func (*Logger) Sync

func (l *Logger) Sync() error

func (*Logger) Trace

func (l *Logger) Trace(ctx context.Context, funcName string) func()

func (*Logger) Warn

func (l *Logger) Warn(msg string, fields ...zap.Field)

func (*Logger) WarnCtx added in v0.0.2

func (l *Logger) WarnCtx(ctx context.Context, msg string, fields ...zap.Field)

func (*Logger) With

func (l *Logger) With(fields ...zap.Field) *Logger

func (*Logger) WithContext

func (l *Logger) WithContext(ctx context.Context) *Logger

type Option

type Option func(*Logger)

func WithEnv

func WithEnv(env string) Option

func WithLevel added in v0.0.5

func WithLevel(level zapcore.Level) Option

func WithLogToFile added in v0.0.4

func WithLogToFile(logToFile bool) Option

func WithRequestKey

func WithRequestKey(requestKey string) Option

func WithRotate

func WithRotate(rotate bool) Option

func WithRotateAge

func WithRotateAge(rotateAge int) Option

func WithRotateBackups

func WithRotateBackups(rotateBackups int) Option

func WithRotateCompress

func WithRotateCompress(rotateCompress bool) Option

func WithRotatePath

func WithRotatePath(rotatePath string) Option

func WithRotateSize

func WithRotateSize(rotateSize int) Option

func WithServiceName

func WithServiceName(serviceName string) Option

func WithUserKey

func WithUserKey(userKey string) Option

func WithVersionName

func WithVersionName(versionName string) Option

Jump to

Keyboard shortcuts

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