Brijesh's Git Server — watchman_client @ 32320e7fdb3668d20efb3e96289935632db03e5b

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,
	)
}