fix logging

This commit is contained in:
fade 2022-09-23 00:42:52 -04:00
parent 6c718b73ae
commit 262a480ffe
2 changed files with 4 additions and 5 deletions

2
bot.go
View File

@ -24,8 +24,6 @@ var (
) )
func RunBot() { func RunBot() {
LoggerInit()
events, err := c.StreamingUser(ctx) events, err := c.StreamingUser(ctx)
if err != nil { if err != nil {
ErrorLogger.Println("Streaming") ErrorLogger.Println("Streaming")

View File

@ -1,6 +1,7 @@
package main package main
import ( import (
"io"
"log" "log"
"os" "os"
) )
@ -16,7 +17,7 @@ func LoggerInit() {
if err != nil { if err != nil {
log.Fatal("Failed to read log file") log.Fatal("Failed to read log file")
} }
InfoLogger = log.New(file, "[INFO] ", log.LstdFlags|log.Lshortfile) InfoLogger = log.New(io.MultiWriter(os.Stdout, file), "[INFO] ", log.LstdFlags|log.Lshortfile)
WarnLogger = log.New(file, "[WARNING] ", log.LstdFlags|log.Lshortfile) WarnLogger = log.New(io.MultiWriter(os.Stdout, file), "[WARNING] ", log.LstdFlags|log.Lshortfile)
ErrorLogger = log.New(file, "[ERROR] ", log.LstdFlags|log.Lshortfile) ErrorLogger = log.New(io.MultiWriter(os.Stdout, file), "[ERROR] ", log.LstdFlags|log.Lshortfile)
} }