Documentation ¶
Index ¶
- Constants
- Variables
- func Always(format string, a ...interface{})
- func Critical(format string, a ...interface{})
- func Debug(format string, a ...interface{})
- func Deprecated(format string, a ...interface{})
- func Info(format string, a ...interface{})
- func LineBytes(prefix, format string, a ...interface{}) []byte
- func Success(format string, a ...interface{})
- func Warning(format string, a ...interface{})
- type LoggerFunc
- type WriterMode
Constants ¶
View Source
const ( // [Log Constants] // // These are the bitwise values for the // various log options. // // Also these are the string prefixes // for the log lines. LogAlways = 1 PreAlways = "Always " LogSuccess = 2 PreSuccess = "Success " LogCritical = 4 PreCritical = "Critical " LogWarning = 8 PreWarning = "Warning " LogInfo = 16 PreInfo = "Info " LogDebug = 32 PreDebug = "Debug " LogDeprecated = 64 PreDeprecated = "Deprecated" LogLegacyLevel2 = LogAlways | LogSuccess | LogCritical | LogWarning | LogInfo LogLegacyLevel2Deprecated = LogLegacyLevel2 | LogDeprecated // Enable all Logging levels // [127] LogEverything = LogAlways | LogSuccess | LogDebug | LogInfo | LogWarning | LogCritical | LogDeprecated )
Variables ¶
View Source
var ( // BitwiseLevel is the preferred // way of managing log levels. // // ----- [ Bitwise Chart ] ------ // // LogEverything (All Levels) // LogAlways // LogSuccess // LogCritical // LogWarning // LogInfo // LogDebug // LogDeprecated // // TODO @kris-nova In the next release flip to LogEverything // BitwiseLevel = LogEverything BitwiseLevel = LogLegacyLevel2Deprecated // A custom io.Writer to use regardless of Mode Writer io.Writer = os.Stdout // Layout is the time layout string to use Layout string = time.RFC3339 )
View Source
var Line = func(prefix, format string, a ...interface{}) string { if !strings.Contains(format, "\n") { format = fmt.Sprintf("%s%s", format, "\n") } if Timestamps { now := time.Now() fNow := now.Format(Layout) prefix = fmt.Sprintf("%s [%s]", fNow, prefix) } else { prefix = fmt.Sprintf("[%s]", prefix) } return fmt.Sprintf("%s %s", prefix, fmt.Sprintf(format, a...)) }
Line will format a log line, and return a string
Functions ¶
func Deprecated ¶
func Deprecated(format string, a ...interface{})
Used to show deprecated log lines
Types ¶
type LoggerFunc ¶
type LoggerFunc func(format string, a ...interface{})
type WriterMode ¶
type WriterMode int
Click to show internal directories.
Click to hide internal directories.