mastodon-group-bot/logger.go

23 lines
495 B
Go
Raw Normal View History

2022-08-28 19:37:43 +03:00
package main
import (
"log"
"os"
)
var (
InfoLogger *log.Logger
WarnLogger *log.Logger
ErrorLogger *log.Logger
)
2022-09-08 15:26:25 +03:00
func LoggerInit() {
2022-08-28 19:37:43 +03:00
file, err := os.OpenFile(*LogPath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0600)
if err != nil {
log.Fatal("Failed to read log file")
}
InfoLogger = log.New(file, "[INFO] ", log.LstdFlags|log.Lshortfile)
WarnLogger = log.New(file, "[WARNING] ", log.LstdFlags|log.Lshortfile)
ErrorLogger = log.New(file, "[ERROR] ", log.LstdFlags|log.Lshortfile)
}