slogcommon

package module
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 10, 2023 License: MIT Imports: 9 Imported by: 59

README ΒΆ

Nothing to see here

tag Go Version GoDoc Build Status Go report Coverage Contributors License

A toolchain for slog Go library.

This project gathers common functions for my slog Go libraries:

🀝 Contributing

Don't hesitate ;)

# Install some dev dependencies
make tools

# Run tests
make test
# or
make watch-test

πŸ‘€ Contributors

Contributors

πŸ’« Show your support

Give a ⭐️ if this project helped you!

GitHub Sponsors

πŸ“ License

Copyright Β© 2023 Samuel Berthe.

This project is MIT licensed.

Documentation ΒΆ

Index ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

This section is empty.

Functions ΒΆ

func AnyValueToString ΒΆ

func AnyValueToString(v slog.Value) string

func AppendAttrsToGroup ΒΆ

func AppendAttrsToGroup(groups []string, actualAttrs []slog.Attr, newAttrs ...slog.Attr) []slog.Attr

func AttrToValue ΒΆ

func AttrToValue(attr slog.Attr) (string, any)

func AttrsToString ΒΆ added in v0.3.0

func AttrsToString(attrs ...slog.Attr) map[string]string

func AttrsToValue ΒΆ

func AttrsToValue(attrs ...slog.Attr) map[string]any

func ConcatRecordAttrToAttr ΒΆ added in v0.8.0

func ConcatRecordAttrToAttr(attrs []slog.Attr, record *slog.Record) []slog.Attr

func FindAttrByGroupAndKey ΒΆ

func FindAttrByGroupAndKey(attrs []slog.Attr, groups []string, key string) (slog.Attr, bool)

func FindAttrByKey ΒΆ

func FindAttrByKey(attrs []slog.Attr, key string) (slog.Attr, bool)

func FormatError ΒΆ

func FormatError(err error) map[string]any

func FormatErrorKey ΒΆ

func FormatErrorKey(values map[string]any, errorKeys ...string) map[string]any

func FormatRequest ΒΆ added in v0.5.0

func FormatRequest(req *http.Request, ignoreHeaders bool) map[string]any

func ReplaceAttrs ΒΆ added in v0.7.0

func ReplaceAttrs(fn ReplaceAttrFn, groups []string, attrs ...slog.Attr) []slog.Attr

func Source ΒΆ added in v0.9.0

func Source(sourceKey string, r *slog.Record) slog.Attr

func UniqAttrs ΒΆ

func UniqAttrs(attrs []slog.Attr) []slog.Attr

@TODO: should be recursive

func ValueToString ΒΆ added in v0.2.0

func ValueToString(v slog.Value) string

Types ΒΆ

type ReplaceAttrFn ΒΆ added in v0.7.0

type ReplaceAttrFn = func(groups []string, a slog.Attr) slog.Attr

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL