Documentation
¶
Index ¶
- type LogLevel
- type Logger
- func (l *Logger) Close() error
- func (l *Logger) Debug(msg string, v ...interface{})
- func (l *Logger) DisableFile()
- func (l *Logger) EnableFile(path string) error
- func (l *Logger) Error(msg string, v ...interface{})
- func (l *Logger) Fatal(msg string, v ...interface{})
- func (l *Logger) Info(msg string, v ...interface{})
- func (l *Logger) SetLevel(level LogLevel)
- func (l *Logger) Warning(msg string, v ...interface{})
- func (l *Logger) WithCaller(enable bool)
- func (l *Logger) WithColors(enable bool)
- func (l *Logger) WithJSON()
- func (l *Logger) WithTimeFormat(layout string)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func NewLogger ¶
NewLogger constructs a Logger with functional options. Options are applied before any file is opened, so options like WithFilePath should be provided to have effect. NewLogger may return an error if opening the configured file fails.
func (*Logger) EnableFile ¶ added in v0.2.0
func (*Logger) WithCaller ¶ added in v0.2.0
func (*Logger) WithColors ¶ added in v0.2.0
func (*Logger) WithTimeFormat ¶ added in v0.2.0
type Option ¶ added in v0.3.0
type Option func(*Logger)
Option configures a Logger during construction.
func WithCaller ¶ added in v0.3.0
func WithColors ¶ added in v0.3.0
func WithFilePath ¶ added in v0.3.0
WithFilePath sets a file path to open and write logs into. NewLogger will attempt to open the file and may return an error if it fails.
func WithTimeFormat ¶ added in v0.3.0
func WithWriter ¶ added in v0.3.0
WithWriter sets the destination used for console loggers (defaults to os.Stdout).
Click to show internal directories.
Click to hide internal directories.