Documentation ¶
Index ¶
- Constants
- func GetPrefix() string
- func NewEntryWithPrefix(prefix string) *logrus.Entry
- func Prefix(prefix string) *logrus.Entry
- func SetPrefix(prefix string)
- type Logger
- func (logger *Logger) Ask(query string) (string, error)
- func (logger *Logger) AskSecret(query string) (string, error)
- func (logger *Logger) Copy() *Logger
- func (logger *Logger) Debug(args ...interface{})
- func (logger *Logger) Debugf(format string, args ...interface{})
- func (logger *Logger) Debugln(args ...interface{})
- func (logger *Logger) Error(message string)
- func (logger *Logger) Errorf(format string, args ...interface{})
- func (logger *Logger) Errorln(args ...interface{})
- func (logger *Logger) Fatal(args ...interface{})
- func (logger *Logger) Fatalf(format string, args ...interface{})
- func (logger *Logger) Fatalln(args ...interface{})
- func (logger *Logger) GetPrefix() string
- func (logger *Logger) Info(message string)
- func (logger *Logger) Infof(format string, args ...interface{})
- func (logger *Logger) Infoln(args ...interface{})
- func (logger *Logger) NewEntryWithPrefix(prefix string) *logrus.Entry
- func (logger *Logger) Output(message string)
- func (logger *Logger) Panic(args ...interface{})
- func (logger *Logger) Panicf(format string, args ...interface{})
- func (logger *Logger) Panicln(args ...interface{})
- func (logger *Logger) Prefix(prefix string) *logrus.Entry
- func (logger *Logger) Print(args ...interface{})
- func (logger *Logger) Printf(format string, args ...interface{})
- func (logger *Logger) Println(args ...interface{})
- func (logger *Logger) SetPrefix(prefix string)
- func (logger *Logger) Warn(message string)
- func (logger *Logger) Warnf(format string, args ...interface{})
- func (logger *Logger) Warning(args ...interface{})
- func (logger *Logger) Warningf(format string, args ...interface{})
- func (logger *Logger) Warningln(args ...interface{})
- func (logger *Logger) Warnln(args ...interface{})
- type TextFormatter
Constants ¶
const ( OutputKey = "log_output" FilenameKey = "log_filename" LevelKey = "log_level" ForceColorsKey = "log_color" DisableColorsKey = "log_nocolor" DisableTimestampKey = "log_notimestamp" ShortTimestampKey = "log_shorttimestamp" TimestampFormatKey = "log_formattimestamp" )
OutputKey is the viper variable used to define the output FilenameKey is the viper variable used to define log filename LevelKey is the viper variable used to define log level key ForceColorsKey is the viper variable used to define if color should be forced DisableColorsKey is the viper variable used to define if the colors should be disabled DisableTimestampKey is the viper variable used to define if the log timestamp should be disabled ShortTimestampKey is the viper variable used to define the log timestamp short format TimestampFormatKey is the viper variable used to define the log timestamp format
const (
PrefixField = "prefix"
)
PrefixField is the viper variable to set and get the prefix to use in the text formatter
Variables ¶
This section is empty.
Functions ¶
func NewEntryWithPrefix ¶
NewEntryWithPrefix creates a new logrus.Entry with a prefix.
Types ¶
type Logger ¶
Logger encapsulate logrus.Logger and add the prefix. It also implements the interface cli.Ui from github.com/mitchellh/cli to print logs using the text formatter
func NewDefault ¶
func NewDefault() *Logger
NewDefault creates a new Logger configured with defaults values or global viper values if they are defined.
func (*Logger) Ask ¶
Ask asks the user for input using the given query. This UI do not ask questions so it implements nothing.
func (*Logger) AskSecret ¶
AskSecret asks the user for input using the given query, but does not echo the keystrokes to the terminal. This UI do not ask questions so it implements nothing.
func (*Logger) Debug ¶
func (logger *Logger) Debug(args ...interface{})
Debug redeclares the logrus method with the same name to use the prefix set
func (*Logger) Debugf ¶
Debugf redeclares the logrus method with the same name to use the prefix set
func (*Logger) Debugln ¶
func (logger *Logger) Debugln(args ...interface{})
Debugln redeclares the logrus method with the same name to use the prefix set
func (*Logger) Errorf ¶
Errorf redeclares the logrus method with the same name to use the prefix set
func (*Logger) Errorln ¶
func (logger *Logger) Errorln(args ...interface{})
Errorln redeclares the logrus method with the same name to use the prefix set
func (*Logger) Fatal ¶
func (logger *Logger) Fatal(args ...interface{})
Fatal redeclares the logrus method with the same name to use the prefix set
func (*Logger) Fatalf ¶
Fatalf redeclares the logrus method with the same name to use the prefix set
func (*Logger) Fatalln ¶
func (logger *Logger) Fatalln(args ...interface{})
Fatalln redeclares the logrus method with the same name to use the prefix set
func (*Logger) Infoln ¶
func (logger *Logger) Infoln(args ...interface{})
Infoln redeclares the logrus method with the same name to use the prefix set
func (*Logger) NewEntryWithPrefix ¶
NewEntryWithPrefix creates a new logrus.Entry with a prefix.
func (*Logger) Panic ¶
func (logger *Logger) Panic(args ...interface{})
Panic redeclares the logrus method with the same name to use the prefix set
func (*Logger) Panicf ¶
Panicf redeclares the logrus method with the same name to use the prefix set
func (*Logger) Panicln ¶
func (logger *Logger) Panicln(args ...interface{})
Panicln redeclares the logrus method with the same name to use the prefix set
func (*Logger) Prefix ¶
Prefix is an alias for NewEntryWithPrefix. It's used to print a message with a prefix
func (*Logger) Print ¶
func (logger *Logger) Print(args ...interface{})
Print redeclares the logrus method with the same name to use the prefix set
func (*Logger) Printf ¶
Printf redeclares the logrus method with the same name to use the prefix set
func (*Logger) Println ¶
func (logger *Logger) Println(args ...interface{})
Println redeclares the logrus method with the same name to use the prefix set
func (*Logger) Warning ¶
func (logger *Logger) Warning(args ...interface{})
Warning redeclares the logrus method with the same name to use the prefix set
func (*Logger) Warningf ¶
Warningf redeclares the logrus method with the same name to use the prefix set
type TextFormatter ¶
type TextFormatter struct { // Set to true to bypass checking for a TTY before outputting colors. ForceColors bool // Force disabling colors. DisableColors bool // Disable timestamp logging. useful when output is redirected to logging // system that already adds timestamps. DisableTimestamp bool // Enable logging just the time passed since beginning of execution instead of // the full timestamp when a TTY is attached ShortTimestamp bool // TimestampFormat to use for display when a full timestamp is printed TimestampFormat string // The fields are sorted by default for a consistent output. For applications // that log extremely frequently and don't use the JSON formatter this may not // be desired. DisableSorting bool }
TextFormatter ...