-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogging.go
45 lines (35 loc) · 788 Bytes
/
logging.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package templateManager
/*
Functions dedicated to logging
*/
import (
"fmt"
)
// Logs error messages
func logError(format string, a ...any) error {
if consoleErrors {
fmt.Println("\033[31m" + fmt.Sprintf(format, a...) + "\033[0m")
}
if haltOnErrors {
return fmt.Errorf(format, a...)
}
return nil
}
// Logs warning messages
func logWarning(format string, a ...any) error {
if consoleWarnings {
fmt.Println("\033[33m" + fmt.Sprintf(format, a...) + "\033[0m")
}
if haltOnWarnings {
return fmt.Errorf(format, a...)
}
return nil
}
// Logs informational messages
func logInformation(information string) {
fmt.Println("\033[36m" + information + "\033[0m")
}
// Logs success messages
func logSuccess(success string) {
fmt.Println("\033[32m" + success + "\033[0m")
}