logger

package module
v0.0.0-...-8e0507c Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

README

logger

import

go get github.com/13inary/logger

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Any

func Any(key string, val any) zapcore.Field

func Bool

func Bool(key string, val bool) zapcore.Field

func Debug

func Debug(msg string, args ...zapcore.Field)

func Debugf

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

func Duration

func Duration(key string, val time.Duration) zapcore.Field

func Err

func Err(err error) zapcore.Field

func Error

func Error(msg string, args ...zapcore.Field)

func Errorf

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

func Fatal

func Fatal(msg string, args ...zapcore.Field)

func Fatalf

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

func Float64

func Float64(key string, val float64) zapcore.Field

func Info

func Info(msg string, args ...zapcore.Field)

func Infof

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

func InitLogger

func InitLogger(consoleDebugModel bool, fileDebugModel bool, logPath string) error

InitLogger 初始化日志模块。日志使用方法1:这里管理日志模块

logPath 若为空,则表示使用默认路径:./log/service.log

func Int

func Int(key string, val int) zapcore.Field

func Int64

func Int64(key string, val int64) zapcore.Field

func NewLogger

func NewLogger(consoleDebugModel bool, fileDebugModel bool, logPath string) (*zap.Logger, *zap.SugaredLogger)

NewLogger 初始化日志模块。日志使用方法2:引用的项目自己管理日志模块

logPath 若为空,则表示使用默认路径:./log/service.log
callerSkip 调用栈跳过层数

func Panic

func Panic(msg string, args ...zapcore.Field)

func Panicf

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

func Str

func Str(key string, val string) zapcore.Field

func Sync

func Sync() error

Sync 同步缓存

func Time

func Time(key string, val time.Time) zapcore.Field

func Warn

func Warn(msg string, args ...zapcore.Field)

func Warnf

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

Types

type ObjectBase

type ObjectBase struct {
}

func (ObjectBase) MarshalLogObject

func (u ObjectBase) MarshalLogObject(enc zapcore.ObjectEncoder) error

实现 zapcore.ObjectMarshaler 接口

Jump to

Keyboard shortcuts

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