diff options
Diffstat (limited to 'llog')
-rw-r--r-- | llog/llog.go | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llog/llog.go b/llog/llog.go index e02af74..54620ed 100644 --- a/llog/llog.go +++ b/llog/llog.go @@ -2,14 +2,21 @@ package llog import ( "fmt" + "time" ) // Good prints a "good" (green) message with a timestamp and the given message func Good(text string) { - fmt.Printf("\033[36m [+] \033[0m%-60s\t", text) + fmt.Printf("%s\033[36m [+] \033[0m%-60s\t", currentTime(), text) } // Bad prints a "good" (green) message with a timestamp and the given message func Bad(text string) { - fmt.Printf("\033[31m [+] \033[0m%-60s\t", text) + fmt.Printf("%s\033[31m [+] \033[0m%-60s\t", currentTime(), text) +} + +// current_time returns the current time as a string in the HH:MM:SS format +func currentTime() string { + t := time.Now() + return fmt.Sprintf("%02d:%02d:%02d", t.Hour(), t.Minute(), t.Second()) } |