Documentation ¶
Overview ¶
Package logger is a simple but customizable logger used by ratchet.
Index ¶
- Constants
- Variables
- func Debug(v ...interface{})
- func Error(v ...interface{})
- func ErrorWithoutTrace(v ...interface{})
- func Info(v ...interface{})
- func SetLogfile(filepath string)
- func SetOutput(out io.Writer)
- func Status(v ...interface{})
- func WithPrefix(v ...interface{}) []interface{}
- type RatchetNotifier
Constants ¶
const ( LevelDebug = iota LevelInfo LevelError LevelStatus LevelSilent )
Ordering the importance of log information. See LogLevel below.
const ( Lwithoutfile = 0 Llongfile = log.Llongfile Lshortfile = log.Lshortfile )
Variables ¶
var LogLevel = LevelInfo
LogLevel can be set to one of: logger.LevelDebug, logger.LevelInfo, logger.LevelError, logger.LevelStatus, or logger.LevelSilent
var LoggerFlag = Lwithoutfile
LoggerFlag can be set to one of: logger.Lwithoutfile, logger.Llongfile, logger.Lshortfile
This will control if file information is prepended to logs See https://golang.ir/pkg/log/#pkg-constants
Functions ¶
func Debug ¶
func Debug(v ...interface{})
Debug logs output when LogLevel is set to at least Debug level
func Error ¶
func Error(v ...interface{})
Error logs output when LogLevel is set to at least Error level
func ErrorWithoutTrace ¶
func ErrorWithoutTrace(v ...interface{})
ErrorWithoutTrace logs output when LogLevel is set to at least Error level but doesn't send the stack trace to Notifier. This is useful only when using a RatchetNotifier implementation.
func Info ¶
func Info(v ...interface{})
Info logs output when LogLevel is set to at least Info level
func SetLogfile ¶
func SetLogfile(filepath string)
SetLogfile can be used to log to a file as well as Stdout.
func Status ¶
func Status(v ...interface{})
Status logs output when LogLevel is set to at least Status level Status output is high-level status events like stages starting/completing.
func WithPrefix ¶
func WithPrefix(v ...interface{}) []interface{}
Types ¶
type RatchetNotifier ¶
RatchetNotifier is an interface for receiving log events. See the Notifier variable.
var Notifier RatchetNotifier
Notifier can be set to receive log events in your external implementation code. Useful for doing custom alerting, etc.