about summary refs log tree commit diff
path: root/llog
diff options
context:
space:
mode:
authoremile <hanemile@protonmail.com>2018-10-08 17:51:50 +0200
committeremile <hanemile@protonmail.com>2018-10-08 17:51:50 +0200
commitf095dd57cbc45923355c1fad02a06c7be0bf15d0 (patch)
tree2963873112b457f02a7fe3aa0027c5f4d472e91e /llog
parent0325ae96f9e5a0f751d42ff59887b76a40a746e6 (diff)
Implement the fancy llog log printing system
Diffstat (limited to 'llog')
-rw-r--r--llog/llog.go11
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())
 }