Documentation ¶
Index ¶
- Constants
- func AddHook(hook Hook)
- func Debugf(ctx context.Context, format string, args ...interface{})
- func Errorf(ctx context.Context, format string, args ...interface{})
- func Fatalf(ctx context.Context, format string, args ...interface{})
- func FromTraceIDContext(ctx context.Context) string
- func FromUserUUIDContext(ctx context.Context) string
- func Infof(ctx context.Context, format string, args ...interface{})
- func NewTraceIDContext(ctx context.Context, traceID string) context.Context
- func NewUserUUIDContext(ctx context.Context, userUUID string) context.Context
- func Printf(ctx context.Context, format string, args ...interface{})
- func SetFormatter(format string)
- func SetLevel(level int)
- func SetOutput(out io.Writer)
- func SetTraceIDFunc(fn TraceIDFunc)
- func SetVersion(v string)
- func StartSpanWithCall(ctx context.Context, opts ...SpanOption) func() *Entry
- func Warnf(ctx context.Context, format string, args ...interface{})
- type Entry
- func (e *Entry) Debugf(format string, args ...interface{})
- func (e *Entry) Errorf(format string, args ...interface{})
- func (e *Entry) Fatalf(format string, args ...interface{})
- func (e *Entry) Infof(format string, args ...interface{})
- func (e *Entry) Printf(format string, args ...interface{})
- func (e *Entry) Warnf(format string, args ...interface{})
- func (e *Entry) WithField(key string, value interface{}) *Entry
- func (e *Entry) WithFields(fields map[string]interface{}) *Entry
- type Hook
- type Logger
- type SpanOption
- type TraceIDFunc
Constants ¶
const ( TraceIDKey = "trace_id" UserUUIDKey = "user_uuid" SpanTitleKey = "span_title" SpanFunctionKey = "span_function" VersionKey = "version" )
Define key name
Variables ¶
This section is empty.
Functions ¶
func FromTraceIDContext ¶
FromTraceIDContext - Get the tracking ID from the context
func FromUserUUIDContext ¶
FromUserUUIDContext - Get the user ID from the context
func NewTraceIDContext ¶
NewTraceIDContext - Create a tracking ID context
func NewUserUUIDContext ¶
NewUserUUIDContext - Create a user ID context
func SetTraceIDFunc ¶
func SetTraceIDFunc(fn TraceIDFunc)
SetTraceIDFunc - Set the processing function of the tracking ID
func StartSpanWithCall ¶
func StartSpanWithCall(ctx context.Context, opts ...SpanOption) func() *Entry
StartSpanWithCall - Start a tracking unit (callback execution)
Types ¶
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
Entry - Define a unified log write mode
func StartSpan ¶
func StartSpan(ctx context.Context, opts ...SpanOption) *Entry
StartSpan - Start a tracking unit
func (*Entry) WithFields ¶
WithFields - Structured field write
type SpanOption ¶
type SpanOption func(*spanOptions)
SpanOption - Define the data item of the tracking unit
func SetSpanFuncName ¶
func SetSpanFuncName(funcName string) SpanOption
SetSpanFuncName - Set the function name of the tracking unit
func SetSpanTitle ¶
func SetSpanTitle(title string) SpanOption
SetSpanTitle - Set the title of the tracking unit
type TraceIDFunc ¶
type TraceIDFunc func() string
TraceIDFunc - Define the function to get the tracking ID