Documentation ¶
Index ¶
- Constants
- func Debug(commit string, args ...interface{})
- func Emphasize(commit string, args ...interface{})
- func EndColor()
- func Error(commit string, args ...interface{})
- func Fatal(commit string, exitStatusCode int)
- func Finalize()
- func Info(commit string, args ...interface{})
- func Init(logFileDir, logFileNamePrefix, logInFilePrefix string, args ...interface{})
- func Panic(commit string, args ...interface{})
- func Pause()
- func PrintBlue(s string, v ...interface{})
- func PrintBlueE(s string, v ...interface{})
- func PrintDefault(s string, v ...interface{})
- func PrintDefaultE(s string, v ...interface{})
- func PrintGreen(s string, v ...interface{})
- func PrintGreenE(s string, v ...interface{})
- func PrintRed(s string, v ...interface{})
- func PrintRedE(s string, v ...interface{})
- func Report()
- func SetCallerDepth(callDepth int)
- func SetPrintAbsolutePath(status bool)
- func Start()
- func StartBlue()
- func StartGreen()
- func StartRed()
- func Warn(commit string, args ...interface{})
- type Slice
Constants ¶
const ( // Used in func hlog.Init as optional argument. Log at stdout and stderr (depends on the log category) and write to file. AutoScreenFile oStreamFlagType = iota // Used in func hlog.Init as optional argument. Log at stdout and stderr (depends on the log category) but not write to file. AutoScreen // Used in func hlog.Init as optional argument. Log at stdout (whatever the log category) and write to file. AllStdOutScreenFile // Used in func hlog.Init as optional argument. Log at stdout (whatever the log category) but not write to file. AllStdOutScreen // Used in func hlog.Init as optional argument. Write to file but not print at screen (higher logging speed). OnlyFile )
Variables ¶
This section is empty.
Functions ¶
func Debug ¶
func Debug(commit string, args ...interface{})
Debug prints a log in blue color with [DBG] prefix.
Init hlog first is necessary.
func Emphasize ¶
func Emphasize(commit string, args ...interface{})
Emphasize prints a log in green color with [EMP] prefix.
Init hlog first is necessary.
func EndColor ¶ added in v0.1.2
func EndColor()
Text color will restore to default after calling this func.
func Error ¶
func Error(commit string, args ...interface{})
Error prints a log in red color with [ERR] prefix.
Init hlog first is necessary.
func Fatal ¶
Fatal prints a log in red color with [FAT] prefix and exit. Exit status code must be specified.
Note exit status code is an uint8 in most POSIX-like system, not int32 or uint32. Conventionally, code zero indicates success, non-zero an error. For portability, the status code should be in the range [0, 125].
Init hlog first is necessary.
func Finalize ¶
func Finalize()
Finalize ensure all logs will be recorded and written to file (if necessary).
It is recommended to use it followed by Init in a defer statement.
func Info ¶
func Info(commit string, args ...interface{})
Info prints a log in default color with [INF] prefix.
Init hlog first is necessary.
func Init ¶
func Init(logFileDir, logFileNamePrefix, logInFilePrefix string, args ...interface{})
Initialize hlog.
Call it before adding any logs.
func Panic ¶
func Panic(commit string, args ...interface{})
Panic prints a log in red color with [PAN] prefix and throw a panic.
Init hlog first is necessary.
func PrintBlue ¶ added in v0.1.1
func PrintBlue(s string, v ...interface{})
Print formated string in blue color on stdout using printf-style.
func PrintBlueE ¶
func PrintBlueE(s string, v ...interface{})
Print formated string in blue color on stderr using printf-style.
func PrintDefault ¶
func PrintDefault(s string, v ...interface{})
Print formated string in default color on stdout using printf-style.
func PrintDefaultE ¶
func PrintDefaultE(s string, v ...interface{})
Print formated string in default color on stderr using printf-style.
func PrintGreen ¶
func PrintGreen(s string, v ...interface{})
Print formated string in green color on stdout using printf-style.
func PrintGreenE ¶
func PrintGreenE(s string, v ...interface{})
Print formated string in green color on stderr using printf-style.
func PrintRed ¶
func PrintRed(s string, v ...interface{})
Print formated string in red color on stdout using printf-style.
func PrintRedE ¶
func PrintRedE(s string, v ...interface{})
Print formated string in red color on stderr using printf-style.
func SetCallerDepth ¶ added in v0.1.1
func SetCallerDepth(callDepth int)
Which func and file line to print in func call stack.
func SetPrintAbsolutePath ¶ added in v0.1.1
func SetPrintAbsolutePath(status bool)
Print absolute file path or not in a log. False by default.
func StartGreen ¶ added in v0.1.2
func StartGreen()
Text color will be green after calling this func.