Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
Logger is influenced by gokit's log (https://pkg.go.dev/github.com/go-kit/kit@v0.10.0/log), but I did not agree with the oversimplification of their interface -- obfuscates too much. I wanted a structured logger which did not hide how to use it, was simple (i only want to implement a couple methods), and allowed all the complexity of what package was being used (e.g. zap, logrus, etc.) to be handled in a "New" function and a single call function -- aka "Print".
type LogrusLogger ¶
LogrusLogger is our struct to implement the Logger interface.
func NewLogrusLogger ¶
func NewLogrusLogger(logLevel, logFilename, logType string) (*LogrusLogger, error)
NewLogrusLogger is a convenience function to create a logrus Logger which implements Logger interface.
logLevel is "trace", "debug", "info", "warn", "error", "fatal", or "panic" and will be the minimum level the Logger will log in the file or console. If level is empty, it will default to "info" level.
logFilename is where you want the log file stored. If this is empty, it will default to stdout.
logType is "json" or "text". If this is empty, it will default to "json".
type ZapLogger ¶
type ZapLogger struct { Logger *zap.Logger Level string Atom zap.AtomicLevel }
ZapLogger is the struct which implements the Logger interface which allows access to the "go.uber.org/zap" style of logging.
func NewZapLogger ¶
NewZapLogger provides a newly initialized Zap Logger which implements Logger interface.
level is "trace", "debug", "info", "warn", "error" which will be the minimum level this Logger will log in the file or console. If level is empty, it will default to "info" level.
logLocations s where you want the log file stored. If this is empty, it will default to stdout.
logType is "json" or "text". If this is empty, it will default to "json".