From f095dd57cbc45923355c1fad02a06c7be0bf15d0 Mon Sep 17 00:00:00 2001 From: emile Date: Mon, 8 Oct 2018 17:51:50 +0200 Subject: Implement the fancy llog log printing system --- llog/llog.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'llog/llog.go') 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()) } -- cgit 1.4.1