gookit / slog

📑 Lightweight, configurable, extensible logging library written in Go. Support multi level, multi outputs and built-in multi file logger, buffers, clean, rotate-file handling.一个易于使用的,轻量级、可配置、可扩展的日志库。支持多个级别,输出到多文件;内置文件日志处理、自动切割、清理、压缩等增强功能

Home Page:https://pkg.go.dev/github.com/gookit/slog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doc: add more description for Template keyword

tonyho opened this issue · comments

Any place have the info about the meaning of all kinds of Template keywords?

For example:

const simplestTemplate = "[{{datetime}}] [{{level}}] {{message}} {{data}} {{extra}}"

What's the meaning of data and extra in above template string?

Thanks.

data, extra - Used to logging some complex data

examples:

slog.Warn("warning log message")

slog.WithData(slog.M{
		"key0": 134,
		"key1": "abc",
}).Infof("info log %s", "message")

output:

[WARNING] warning log message
[INFO] info log message {key0:134, key1:abc}