Documentation ¶
Index ¶
- Constants
- Variables
- func Colors() []string
- func FatalOnError(err interface{}, args ...interface{})
- func FormatMessageBox(message []string) []string
- func InitBestEffort(lf *LogFlags)
- func InitStderrLog()
- func Levels() []string
- func PanicOnError(err interface{}, args ...interface{})
- func PrintMessageBox(level logrus.Level, message []string)
- func ReplaceStderrFormatter(newFormatter logrus.Formatter) (oldFormatter logrus.Formatter)
- func ReplaceStderrWriter(newOut io.Writer) (oldOut io.Writer)
- func SetFileLogLevel(level string) (err error)
- func SetStderrLogLevel(level string) (err error)
- func WarningOnError(err interface{}, args ...interface{})
- type LogFlags
Constants ¶
const ( // LevelsPlaceholder are all valid log levels separated by '|' character. LevelsPlaceholder = "(panic|fatal|error|warn|info|debug|trace)" // LevelsFlag is the suggested name of the flag for loglevel LevelsFlag = "log-level" // LevelsHelp is the suggested help message for the loglevel flag LevelsHelp = "The minimum log level." // FileFlag is the suggested name for logfile flag FileFlag = "log-file" // FileFlagHelp is the suggested help message for the logfile flag FileFlagHelp = "Path to the image's log file." // ColorsPlaceholder are all valid log colors separated by '|' character. ColorsPlaceholder = "(always|auto|never)" // ColorFlag is the suggested name for logcolor flag ColorFlag = "log-color" // ColorFlagHelp is the suggested help message for the logcolor flag ColorFlagHelp = "Color setting for log terminal output." )
Variables ¶
var ( // Log contains the shared Logger Log *logrus.Logger )
Functions ¶
func FatalOnError ¶
func FatalOnError(err interface{}, args ...interface{})
FatalOnError logs a fatal error and any message strings, then exists (while running any cleanup functions registered with the log package)
func FormatMessageBox ¶
FormatMessageBox formats a message into a box with a border. The box is automatically sized to fit the longest line. Each line will be centered in the box.
func InitBestEffort ¶
func InitBestEffort(lf *LogFlags)
InitBestEffort runs InitStderrLog always, and InitLogFile if path is not empty
func PanicOnError ¶
func PanicOnError(err interface{}, args ...interface{})
PanicOnError logs the error and any message strings and then panics
func PrintMessageBox ¶
PrintMessageBox prints a message box to the log with the specified log level.
func ReplaceStderrFormatter ¶
ReplaceStderrFormatter replaces the stderr formatter and returns the old formatter
func ReplaceStderrWriter ¶
ReplaceStderrWriter replaces the stderr writer and returns the old one
func SetFileLogLevel ¶
SetFileLogLevel sets the lowest log level for file output
func SetStderrLogLevel ¶
SetStderrLogLevel sets the lowest log level for stderr output
func WarningOnError ¶
func WarningOnError(err interface{}, args ...interface{})
WarningOnError logs a warning error and any message strings