Documentation
¶
Overview ¶
Package log implements the functions, types, and interfaces for the module.
Package log contains generated code by adptool.
Package log acts as a bridge to the Kratos logging library. The adptool directives below generate wrapper code, making Kratos's logging functions and types directly available in this package without non-idiomatic prefixes.
Package log implements the functions, types, and interfaces for the module.
Package log implements the functions, types, and interfaces for the module.
Index ¶
- Constants
- Variables
- func Caller(depth int) kratoslog.Valuer
- func Context(ctx context.Context) *kratoslog.Helper
- func Debug(a ...any)
- func Debugf(format string, a ...any)
- func Debugw(keyvals ...any)
- func Error(a ...any)
- func Errorf(format string, a ...any)
- func Errorw(keyvals ...any)
- func Fatal(a ...any)
- func Fatalf(format string, a ...any)
- func Fatalw(keyvals ...any)
- func FilterFunc(f func(level kratoslog.Level, keyvals ...any) bool) kratoslog.FilterOption
- func FilterKey(key ...string) kratoslog.FilterOption
- func FilterLevel(level kratoslog.Level) kratoslog.FilterOption
- func FilterValue(value ...string) kratoslog.FilterOption
- func GetLogger() kratoslog.Logger
- func Info(a ...any)
- func Infof(format string, a ...any)
- func Infow(keyvals ...any)
- func LevelOption(level string) slogx.Option
- func Log(level kratoslog.Level, keyvals ...any)
- func NewDiscard() kratoslog.Logger
- func NewFilter(logger kratoslog.Logger, opts ...kratoslog.FilterOption) *kratoslog.Filter
- func NewHelper(logger kratoslog.Logger, opts ...kratoslog.Option) *kratoslog.Helper
- func NewStdLogger(w io.Writer) kratoslog.Logger
- func NewWriter(logger kratoslog.Logger, opts ...kratoslog.WriterOptionFn) io.Writer
- func ParseLevel(s string) kratoslog.Level
- func SetLogger(logger kratoslog.Logger)
- func Timestamp(layout string) kratoslog.Valuer
- func Value(ctx context.Context, v any) any
- func Warn(a ...any)
- func Warnf(format string, a ...any)
- func Warnw(keyvals ...any)
- func With(l kratoslog.Logger, kv ...any) kratoslog.Logger
- func WithContext(ctx context.Context, l kratoslog.Logger) kratoslog.Logger
- func WithDecorate(l kratoslog.Logger, info interfaces.AppInfo) kratoslog.Logger
- func WithLogger(logger Logger) options.Option
- func WithMessageKey(k string) kratoslog.Option
- func WithSprint(sprint func(...any) string) kratoslog.Option
- func WithSprintf(sprintf func(format string, a ...any) string) kratoslog.Option
- func WithWriteMessageKey(key string) kratoslog.WriterOptionFn
- func WithWriterLevel(level kratoslog.Level) kratoslog.WriterOptionFn
- type DiscardLogger
- func (d DiscardLogger) Debug(msg string, keyvals ...interface{})
- func (d DiscardLogger) Error(msg string, keyvals ...interface{})
- func (d DiscardLogger) Info(msg string, keyvals ...interface{})
- func (d DiscardLogger) Log(level kratoslog.Level, keyvals ...interface{}) error
- func (d DiscardLogger) Warn(msg string, keyvals ...interface{})
- type Filter
- type FilterOption
- type Helper
- type Level
- type Logger
- type Option
- type Valuer
- type WriterOptionFn
Constants ¶
const ( LevelDebug = kratoslog.LevelDebug LevelError = kratoslog.LevelError LevelFatal = kratoslog.LevelFatal LevelInfo = kratoslog.LevelInfo LevelKey = kratoslog.LevelKey LevelWarn = kratoslog.LevelWarn )
Variables ¶
var ( DefaultCaller = kratoslog.DefaultCaller DefaultLogger = kratoslog.DefaultLogger DefaultMessageKey = kratoslog.DefaultMessageKey DefaultTimestamp = kratoslog.DefaultTimestamp )
Functions ¶
func FilterFunc ¶
func FilterKey ¶
func FilterKey(key ...string) kratoslog.FilterOption
func FilterLevel ¶
func FilterLevel(level kratoslog.Level) kratoslog.FilterOption
func FilterValue ¶
func FilterValue(value ...string) kratoslog.FilterOption
func LevelOption ¶ added in v0.2.0
LevelOption converts a string level to a slogx.Option.
func NewDiscard ¶ added in v0.2.0
func ParseLevel ¶
func WithDecorate ¶ added in v0.2.13
WithDecorate decorates a kratos logger with common service information. It adds fields like service ID, name, version, timestamp, caller, trace ID, and span ID.
func WithLogger ¶ added in v0.2.6
func WithMessageKey ¶
func WithWriteMessageKey ¶
func WithWriteMessageKey(key string) kratoslog.WriterOptionFn
func WithWriterLevel ¶
func WithWriterLevel(level kratoslog.Level) kratoslog.WriterOptionFn
Types ¶
type DiscardLogger ¶ added in v0.2.0
type DiscardLogger struct{}
func (DiscardLogger) Debug ¶ added in v0.2.0
func (d DiscardLogger) Debug(msg string, keyvals ...interface{})
func (DiscardLogger) Error ¶ added in v0.2.0
func (d DiscardLogger) Error(msg string, keyvals ...interface{})
func (DiscardLogger) Info ¶ added in v0.2.0
func (d DiscardLogger) Info(msg string, keyvals ...interface{})
func (DiscardLogger) Log ¶ added in v0.2.0
func (d DiscardLogger) Log(level kratoslog.Level, keyvals ...interface{}) error
func (DiscardLogger) Warn ¶ added in v0.2.0
func (d DiscardLogger) Warn(msg string, keyvals ...interface{})
type FilterOption ¶
type FilterOption = kratoslog.FilterOption
type WriterOptionFn ¶
type WriterOptionFn = kratoslog.WriterOptionFn