Brijesh's Git Server — watchman_client @ main

client library for using watchman in go programs

utils/log_utils.go (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
package utils

import (
	"fmt"
	"os"
)

func IsLogFileEmpty() bool {
	file, _ := os.Open("log.json")
	defer file.Close()
	fileInfo, _ := file.Stat()
	return fileInfo.Size() == 0
}

func PrintLog(log LoggerProps) {
	fmt.Printf(
		"%v [%v] %v: %v\n",
		TimeStampToHumanReadable(log.Timestamp),
		log.Level,
		log.Subject,
		log.Message,
	)
}