added mutex around logs again

This commit is contained in:
0xdcarns
2022-01-31 09:21:19 -05:00
parent d56bdc1ca1
commit 5a5ded1c04
+6
View File
@@ -37,6 +37,9 @@ func ResetLogs() {
// Log - handles adding logs
func Log(verbosity int, message ...string) {
var mu sync.Mutex
mu.Lock()
defer mu.Unlock()
var currentTime = time.Now()
var currentMessage = makeString(message...)
if int32(verbosity) <= getVerbose() && getVerbose() >= 0 {
@@ -102,6 +105,9 @@ func Retrieve(filePath string) string {
// FatalLog - exits os after logging
func FatalLog(message ...string) {
var mu sync.Mutex
mu.Lock()
defer mu.Unlock()
fmt.Printf("[netmaker] Fatal: %s \n", makeString(message...))
os.Exit(2)
}