Categorygithub.com/asif-mahmud/go-log
modulepackage
1.0.0
Repository: https://github.com/asif-mahmud/go-log.git
Documentation: pkg.go.dev

# README

Go Log

A simple package to configure Go's standard log and slog loggers. This package doesn't provide any logger implementation, it just provides an easy way to configure both log and slog by one function call.

# Functions

Extra returns an attribute for ExtraKey.
Ip returns an attribute for IpKey.
Latency returns an attribute for LatencyKey.
Length returns an attribute for LengthKey.
Method returns an attribute for MethodKey.
Path returns an attribute for PathKey.
Query returns an attribute for QueryKey.
Setup configures standard library loggers.
Status returns an attribute for StatusKey.
UserAgent returns an attribute for UserAgentKey.
WithAttr adds an attribute in all of the logs.
WithLevel sets log level.
WithReplacer adds an attribute replacer to customize formatting.
WithSimpleSource enables source logging and logs source in a single string in this format - file:function:line.
WithSource adds caller information in slog's log.
WithText sets up non-json log message writer.
WithWriter sets log writer to wr.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Structs

LogOpt configuration options for settign up built-in loggers.

# Interfaces

Logger a placeholder interface to abstract away slog.Logger methods *slog.Logger can be set as a value of this interface, any other custom logger should follow the same.

# Type aliases

AttrReplacerFunc function definition for replacing attributes.
LogKey type for varius additional keys.
LogOptFunc definition for configuration builder function.