mirror of
https://gitea.phreedom.club/localhost_frssoft/mastodon-group-bot
synced 2024-11-22 04:11:29 +00:00
23 lines
496 B
Go
23 lines
496 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
)
|
|
|
|
var (
|
|
InfoLogger *log.Logger
|
|
WarnLogger *log.Logger
|
|
ErrorLogger *log.Logger
|
|
)
|
|
|
|
func logger_init() {
|
|
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)
|
|
}
|