Documentation
¶
Overview ¶
Package log is a utility module that provides logging capabilities for internal use. Logs that are emitted via this package are NOT for workload execution logs or audit trails
Index ¶
Constants ¶
View Source
const ( // AlertTargetTelegram indicates that alerts should be sent to // Telegram AlertTargetTelegram alertTarget = "telegram" // AlertTypeError defines the 'error' level of alerts AlertTypeError alertType = "error" // AlertTypeInfo defines the 'info' level of alerts AlertTypeInfo alertType = "info" // EnvKeyAlertTelegramChatId defines the environment variable key // where the Telegram chat ID will be retrieved from EnvKeyAlertTelegramChatId = "LOG_ALERT_TELEGRAM_CHAT_ID" // EnvKeyAlertTelegramToken defines the environment variable key // where the Telegram token will be retrieved from EnvKeyAlertTelegramToken = "LOG_ALERT_TELEGRAM_TOKEN" )
View Source
const ( // TimestampYmdHMS uses format "2006-01-02 15:04:05" TimestampYmdHMS = "2006-01-02 15:04:05" // TimestampYmdHMSz uses format "2006-01-02 15:04:05 -0700" TimestampYmdHMSz = "2006-01-02 15:04:05 -0700" // TimestampMySql uses format "2006-01-02 15:04:05.999999" TimestampMySql = "2006-01-02 15:04:05.999999" )
Variables ¶
View Source
var AlertTarget = defaultAlertTarget
View Source
var Formats []Format
Formats contains a list of available formats that is accepted by us and can be useful for providing a list of valid formats in packages that consume this library
View Source
var Levels []Level
Levels defines the available levels, useful for listing the available levels in packages that consume this library
Functions ¶
Types ¶
type FormattedLog ¶
type FormattedLog func(string, ...interface{})
FormatteedLog is like fmt.Printf with fancy formatting
var Printf, Tracef, Debugf, Infof, Warnf, Errorf FormattedLog = printf, loggerInstance.Tracef, loggerInstance.Debugf, loggerInstance.Infof, loggerInstance.Warnf, loggerInstance.Errorf
Printf writes the log to stdout with formatting
type Level ¶
type Level uint
Level defines an accepted log level by this package
const ( // LevelTrace defines the 'trace' level of logging LevelTrace Level = iota // LevelDebug defines the 'debug' level of logging LevelDebug // LevelInfo defines the 'info' level of logging LevelInfo // LevelWarn defines the 'warning' level of logging LevelWarn // LevelError defines the 'error' level of logging LevelError )
type SimpleLog ¶
type SimpleLog func(...interface{})
SimpleLog is like fmt.Print without any fancy formats
var Print, Trace, Debug, Info, Warn, Error SimpleLog = print, loggerInstance.Trace, loggerInstance.Debug, loggerInstance.Info, loggerInstance.Warn, loggerInstance.Error
Print writes the log to stdout
Source Files
¶
Click to show internal directories.
Click to hide internal directories.