Documentation ¶
Overview ¶
Package utils contains some helper functions especially for logging. Let's borrow logger package. https://github.com/rl404/go-malscraper/blob/master/pkg/mallogger/mallogger.go.
Index ¶
- Constants
- func Debug(text string)
- func Error(text string)
- func Fatal(text string)
- func Info(text string)
- func Log(logType string, text string, isNeeded ...bool)
- func LogFmt(text ...string) string
- func Print(textColor ...string)
- func Println(textColor ...string)
- func Success(text string)
- func Trace(text string)
- func Warn(text string)
Constants ¶
View Source
const ( // TimeFormat is timestamp format for utils. TimeFormat = "2006/01/02 15:04:05.000" // SuccessIcon is success utils indicator. SuccessIcon = "[S]" // SuccessType is key to write success utils. SuccessType = "success" // TraceIcon is trace utils indicator. TraceIcon = "[T]" // TraceType is key to write trace utils. TraceType = "trace" // DebugIcon is debug utils indicator. DebugIcon = "[D]" // DebugType is key to write debug utils. DebugType = "debug" // InfoIcon is info utils indicator. InfoIcon = "[I]" // InfoType is key to write info utils. InfoType = "info" // WarnIcon is warning utils indicator. WarnIcon = "[W]" // WarnType is key to write warn utils. WarnType = "warn" // ErrorIcon is error utils indicator. ErrorIcon = "[E]" // ErrorType is key to write error utils. ErrorType = "error" // FatalIcon is fatal error utils indicator. FatalIcon = "[F]" // FatalType is key to write fatal utils. FatalType = "fatal" )
View Source
const ( Reset = "\033[0m" Red = "\033[31m" Green = "\033[32m" Yellow = "\033[33m" Blue = "\033[34m" Magenta = "\033[35m" Cyan = "\033[36m" White = "\033[37m" BrightBlack = "\033[90m" BrightRed = "\033[91m" BrightGreen = "\033[92m" BrightYellow = "\033[93m" BrightBlue = "\033[94m" BrightMagenta = "\033[95m" BrightCyan = "\033[96m" BrightWhite = "\033[97m" )
Foreground text colors. The output colors may vary on different OS. Taken from https://en.wikipedia.org/wiki/ANSI_escape_code.
Variables ¶
This section is empty.
Functions ¶
func Log ¶
Log is helper function for easier call for all utils depends on the boolean (isNeeded). Not writing utils by default.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.