Documentation
¶
Index ¶
- func Debug() *zerolog.Event
- func Error() *zerolog.Event
- func Fatal() *zerolog.Event
- func GroupID(id string) *zerolog.Logger
- func Hook(h zerolog.Hook) zerolog.Logger
- func Info() *zerolog.Event
- func Init()
- func InitWithConfig(config *Config)
- func Log() *zerolog.Event
- func New() *zerolog.Logger
- func NewWithConfig(config *Config) *zerolog.Logger
- func Panic() *zerolog.Event
- func ParseLevel(levelStr string) zerolog.Level
- func ParseWriter(writerConfig WriterConfig) io.Writer
- func Print(v ...interface{})
- func Printf(format string, v ...interface{})
- func Warn() *zerolog.Event
- func With() zerolog.Context
- func WithLevel(level zerolog.Level) *zerolog.Event
- type Config
- type WriterConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
Debug starts a new message with debug level.
You must call Msg on the returned event in order to send the event.
func Error ¶
Error starts a new message with error level.
You must call Msg on the returned event in order to send the event.
func Fatal ¶
Fatal starts a new message with fatal level. The os.Exit(1) function is called by the Msg method.
You must call Msg on the returned event in order to send the event.
func GroupID ¶
GroupID returns a pointer to a zerolog logger with the `groupId` field set to the value of the `id` parameter
func Info ¶
Info starts a new message with info level.
You must call Msg on the returned event in order to send the event.
func Init ¶
func Init()
Init creates a new logger with the default configuration, and sets it as the default logger
func InitWithConfig ¶ added in v0.0.2
func InitWithConfig(config *Config)
InitWithConfig creates a new logger with the given configuration, and sets it as the default logger
func Log ¶
Log starts a new message with no level. Setting zerolog.GlobalLevel to zerolog.Disabled will still disable events produced by this method.
You must call Msg on the returned event in order to send the event.
func NewWithConfig ¶ added in v0.0.2
NewWithConfig is a function that creates a new logger with the given configuration
func Panic ¶
Panic starts a new message with panic level. The message is also sent to the panic function.
You must call Msg on the returned event in order to send the event.
func ParseLevel ¶
ParseLevel converts a level string into a zerolog Level value. returns an error if the input string does not match known values.
func ParseWriter ¶
func ParseWriter(writerConfig WriterConfig) io.Writer
ParseWriter takes a string and returns an io.Writer
func Print ¶
func Print(v ...interface{})
Print sends a log event using debug level and no extra field. Arguments are handled in the manner of fmt.Print.
func Printf ¶
func Printf(format string, v ...interface{})
Printf sends a log event using debug level and no extra field. Arguments are handled in the manner of fmt.Printf.
func Warn ¶
Warn starts a new message with warn level.
You must call Msg on the returned event in order to send the event.
Types ¶
type Config ¶
type Config struct {
Verbose bool
LogLevel zerolog.Level
WriterConfig WriterConfig
}
Config is a struct that contains a boolean, a `zerolog.Level` and an `io.Writer`. @property {bool} Verbose - This is a boolean value that determines whether the application is running in debug mode or not. @property LogLevel - The level of logging you want to use. @property Writer - The writer to which the logs will be written.
type WriterConfig ¶
type WriterConfig struct {
Writer string
Directory string
FileName string
MaxSize int
MaxBackups int
MaxAge int
}
WriterConfig is a struct with 6 fields. @property {string} Writer - The writer to use. This can be either "file" or "console". @property {string} Directory - The directory where the log files will be written. @property {string} FileName - The name of the file to write logs to. @property {int} MaxSize - The maximum size in megabytes of the log file before it gets rotated. It defaults to 100 megabytes. @property {int} MaxBackups - The maximum number of old log files to retain. @property {int} MaxAge - The maximum age of a log file in days