Documentation
¶
Index ¶
- func SetDefaultLogFileName(name string)
- func SetDefaultLogsDirectory(dir string)
- type Logger
- func (l *Logger) Debug(format string, args ...interface{})
- func (l *Logger) Error(format string, args ...interface{})
- func (l *Logger) GetWriter() io.Writer
- func (l *Logger) Info(format string, args ...interface{})
- func (l *Logger) Printf(format string, args ...interface{})
- func (l *Logger) Warn(format string, args ...interface{})
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetDefaultLogFileName ¶
func SetDefaultLogFileName(name string)
Sets the default log file name, if empty or not set via this function, will use "app.log"
func SetDefaultLogsDirectory ¶
func SetDefaultLogsDirectory(dir string)
Sets the default logs directory, if empty or not set via this function, will use "./logs"
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is a simple wrapper around zerolog
func NewLogger ¶
NewLogger creates a new logger with the given options
NOTE: Please use WithConsole() before WithDebug() if you desire to use both ¶
func (*Logger) Debug ¶
Debug logs a message to l.out if log level is debug
Also (pretty) prints to os.Stdout if l.console is true
func (*Logger) Error ¶
Error logs a message to l.out
Also (pretty) prints to os.Stderr if l.console is true
func (*Logger) Info ¶
Info logs a message to l.out
Also (pretty) prints to os.Stdout if l.console is true
type Option ¶
type Option func(*Logger)
Option is a function that modifies the logger
func WithConsole ¶
WithConsole enables (pretty) logging to console
func WithOwnLogFile ¶
WithOwnLogFile sets the log file name to the given name