Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc: add more description for Template keyword #54

Closed
tonyho opened this issue May 19, 2022 · 1 comment
Closed

Doc: add more description for Template keyword #54

tonyho opened this issue May 19, 2022 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@tonyho
Copy link

tonyho commented May 19, 2022

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.

@inhere inhere self-assigned this May 19, 2022
@inhere inhere added the docs label May 19, 2022
@inhere
Copy link
Member

inhere commented May 19, 2022

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}

@inhere inhere added documentation Improvements or additions to documentation and removed docs labels May 24, 2022
@tonyho tonyho closed this as completed May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants