Documentation
¶
Index ¶
- Constants
- Variables
- func Alert(relatedId string, msg interface{}, fields ...Field)
- func AlertCtx(ctx context.Context, relatedId string, msg interface{}, fields ...Field)
- func Alertf(relatedId, format string, a ...any)
- func AlertfCtx(ctx context.Context, relatedId, format string, a ...any)
- func Debug(relatedId string, msg interface{}, fields ...Field)
- func DebugCtx(ctx context.Context, relatedId string, msg interface{}, fields ...Field)
- func Debugf(relatedId, format string, a ...any)
- func DebugfCtx(ctx context.Context, relatedId, format string, a ...any)
- func Error(relatedId string, msg interface{}, fields ...Field)
- func ErrorCtx(ctx context.Context, relatedId string, msg interface{}, fields ...Field)
- func Errorf(relatedId, format string, a ...any)
- func ErrorfCtx(ctx context.Context, relatedId, format string, a ...any)
- func Fatal(relatedId string, msg interface{}, fields ...Field)
- func FatalCtx(ctx context.Context, relatedId string, msg interface{}, fields ...Field)
- func Fatalf(relatedId, format string, a ...any)
- func FatalfCtx(ctx context.Context, relatedId, format string, a ...any)
- func GetTraceId(ctx context.Context) (traceId string)
- func Info(relatedId string, msg interface{}, fields ...Field)
- func InfoCtx(ctx context.Context, relatedId string, msg interface{}, fields ...Field)
- func Infof(relatedId, format string, a ...any)
- func InfofCtx(ctx context.Context, relatedId, format string, a ...any)
- func Init(opts ...Options)
- func MsgMarshal(v interface{}) string
- func NewLog(opts ...Options) *log
- func NewLogger(opts ...Options) *logger
- func NewLoggerWriter() *loggerWriter
- func RandId() string
- func Randn(n int) string
- func Severe(relatedId string, msg interface{}, fields ...Field)
- func SevereCtx(ctx context.Context, relatedId string, msg interface{}, fields ...Field)
- func Severef(relatedId, format string, a ...any)
- func SeverefCtx(ctx context.Context, relatedId, format string, a ...any)
- func Slow(relatedId string, msg interface{}, fields ...Field)
- func SlowCtx(ctx context.Context, relatedId string, msg interface{}, fields ...Field)
- func Slowf(relatedId, format string, a ...any)
- func SlowfCtx(ctx context.Context, relatedId, format string, a ...any)
- func Stat(relatedId string, msg interface{}, fields ...Field)
- func StatCtx(ctx context.Context, relatedId string, msg interface{}, fields ...Field)
- func Statf(relatedId, format string, a ...any)
- func StatfCtx(ctx context.Context, relatedId, format string, a ...any)
- func TraceId() string
- func TraceStart(ctx context.Context) context.Context
- func TraceStartSetTraceId(ctx context.Context, traceId string) context.Context
- func WithSkip(ctx context.Context, val int) context.Context
- type Config
- type Content
- type Field
- type LogContext
- type LogFileLine
- type LogMod
- type Logger
- type LoggerWriter
- type Option
- type Options
Constants ¶
View Source
const ( INFO = "info" ERROR = "error" DEBUG = "debug" FATAL = "fatal" SLOW = "slow" STAT = "stat" SEVERE = "severe" ALERT = "ALERT" )
level
Variables ¶
View Source
var ( TlogTraceId = "tlog_id" TlogRelatedId = "tlog_relatedId" TlogPath = "tlog_path" TlogMsg = "tlog_msg" TlogLabel = "tlog_label" TlogLevel = "tlog_level" )
View Source
var TlogRTField = "tlog_rt"
Functions ¶
func GetTraceId ¶ added in v1.1.13
func MsgMarshal ¶
func MsgMarshal(v interface{}) string
func NewLoggerWriter ¶
func NewLoggerWriter() *loggerWriter
func TraceStartSetTraceId ¶
Types ¶
type Config ¶
type Config struct {
// 系统的开发模式
Mode int
// 日志标签
Label string
LogWriteLimit int
// 日志的Logger对象
LoggerWriter []LoggerWriter
}
type Content ¶
type Content struct {
TraceId string `json:"tlog_traceId"`
Path string `json:"tlog_path"`
RelatedId string `json:"tlog_relatedId"`
Msg string `json:"tlog_msg"`
Label string `json:"tlog_label"`
Level string `json:"tlog_level"`
}
func (*Content) BuildFields ¶
type LogContext ¶
type LogContext struct{}
type LogFileLine ¶
type LogFileLine struct{}
type Logger ¶
type Logger interface {
Errorf(relatedId, format string, a ...any)
Error(relatedId string, msg interface{}, fields ...Field)
ErrorfCtx(ctx context.Context, relatedId, format string, a ...any)
ErrorCtx(ctx context.Context, relatedId string, msg interface{}, fields ...Field)
Info(relatedId string, msg interface{}, fields ...Field)
Infof(relatedId, format string, a ...any)
InfoCtx(ctx context.Context, relatedId string, msg interface{}, fields ...Field)
InfofCtx(ctx context.Context, relatedId, format string, a ...any)
Debug(relatedId string, msg interface{}, fields ...Field)
Debugf(relatedId, format string, a ...any)
DebugCtx(ctx context.Context, relatedId string, msg interface{}, fields ...Field)
DebugfCtx(ctx context.Context, relatedId, format string, a ...any)
Slow(relatedId string, msg interface{}, fields ...Field)
Slowf(relatedId, format string, a ...any)
SlowCtx(ctx context.Context, relatedId string, msg interface{}, fields ...Field)
SlowfCtx(ctx context.Context, relatedId, format string, a ...any)
Stat(relatedId string, msg interface{}, fields ...Field)
Statf(relatedId, format string, a ...any)
StatCtx(ctx context.Context, relatedId string, msg interface{}, fields ...Field)
StatfCtx(ctx context.Context, relatedId, format string, a ...any)
Fatal(relatedId string, msg interface{}, fields ...Field)
Fatalf(relatedId, format string, a ...any)
FatalCtx(ctx context.Context, relatedId string, msg interface{}, fields ...Field)
FatalfCtx(ctx context.Context, relatedId, format string, a ...any)
Severe(relatedId string, msg interface{}, fields ...Field)
Severef(relatedId, format string, a ...any)
SevereCtx(ctx context.Context, relatedId string, msg interface{}, fields ...Field)
SeverefCtx(ctx context.Context, relatedId, format string, a ...any)
Alert(relatedId string, msg interface{}, fields ...Field)
Alertf(relatedId, format string, a ...any)
AlertCtx(ctx context.Context, relatedId string, msg interface{}, fields ...Field)
AlertfCtx(ctx context.Context, relatedId, format string, a ...any)
}
type LoggerWriter ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.
