Documentation
¶
Index ¶
- Variables
- func DefaultLumberjack() *lumberjack.Logger
- type Config
- type Handler
- type HandlerOption
- func HandlerWithFormat(format string) HandlerOption
- func HandlerWithHandlerOptions(opts *slog.HandlerOptions) HandlerOption
- func HandlerWithIoWriter(w io.Writer) HandlerOption
- func HandlerWithLevel(level slog.Level) HandlerOption
- func HandlerWithLumberjack(lumberjackLog *lumberjack.Logger) HandlerOption
- func HandlerWithStackTrace(skip, maxDepth int) HandlerOption
- func HandlerWithStrLevel(level string) HandlerOption
Constants ¶
This section is empty.
Variables ¶
View Source
var TraceId string = "traceId"
Functions ¶
func DefaultLumberjack ¶
func DefaultLumberjack() *lumberjack.Logger
Types ¶
type Config ¶
type Config struct {
*lumberjack.Logger
Format string `json:"format" yaml:"format"`
}
type Handler ¶
func New ¶
func New(opts ...HandlerOption) (h *Handler)
type HandlerOption ¶
type HandlerOption func(h *Handler)
func HandlerWithFormat ¶
func HandlerWithFormat(format string) HandlerOption
HandlerWithFormat 设置日志输出格式: text, json
func HandlerWithHandlerOptions ¶
func HandlerWithHandlerOptions(opts *slog.HandlerOptions) HandlerOption
HandlerWithHandlerOptions 设置处理器配置
func HandlerWithIoWriter ¶
func HandlerWithIoWriter(w io.Writer) HandlerOption
HandlerWithIoWriter 修改配置io写入
func HandlerWithLevel ¶
func HandlerWithLevel(level slog.Level) HandlerOption
HandlerWithLevel 设置日志等级
func HandlerWithLumberjack ¶
func HandlerWithLumberjack(lumberjackLog *lumberjack.Logger) HandlerOption
日志切割配置
func HandlerWithStackTrace ¶
func HandlerWithStackTrace(skip, maxDepth int) HandlerOption
HandlerWithStackTrace 设置StackTrace堆栈跟踪信息
func HandlerWithStrLevel ¶
func HandlerWithStrLevel(level string) HandlerOption
HandlerWithStrLevel 设置日志等级(字符串)
Click to show internal directories.
Click to hide internal directories.