# README
go-logger
Fast, lightweight, customizable and structured logger for Go.
Install
go get github.com/savsgio/go-logger/v3
Supported Go versions:
- 1.20.x
- 1.19.x
- 1.18.x
- 1.17.x
- 1.16.x
- 1.15.x
- 1.14.x
- 1.13.x
Levels:
Level | Code (constant) | Value (str) |
---|---|---|
logger.PRINT | ||
Trace | logger.TRACE | trace / TRACE |
Fatal | logger.FATAL | fatal / FATAL |
Error | logger.ERROR | error / ERROR |
Warning | logger.WARNING | warning / WARNING |
Info | logger.INFO | info / INFO |
Debug | logger.DEBUG | debug / DEBUG |
NOTE: The default level of standard logger is INFO.
Encoders:
- Text
- JSON
- Custom (your own encoder).
NOTE: The default encoder of standard logger is text.
Contributing
Feel free to contribute it or fork me... :wink:
# Functions
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
IsLevelEnabled checks if the given level is enabled on the standard logger.
New creates a new Logger.
NewEncoderJSON creates a new json encoder.
NewEncoderText creates a new text encoder.
ParseLevel returns the Level constant from the given level string.
No description provided by the author
No description provided by the author
SetEncoder sets the encoder to the standard logger.
SetFields sets the fields to the standard logger.
SetFlags sets the output flags to the standard logger.
SetLevel sets the level to the standard logger.
SetOutput sets the output to the standard logger.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
WithFields returns a copy of the standard logger with the given fields.
# Variables
ErrInvalidLevel is the invalid level error.
# Structs
EncoderBase is the base of encoders.
EncoderConfig is the encoder configuration.
EncoderJSON is the json encoder.
EncoderText is the text enconder.
Field type.
Logger type.
# Interfaces
Encoder is the interface of encoders.