2022-03-26 13:23:39 +05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
2022-05-14 14:17:30 +05:00
|
|
|
|
|
|
|
"github.com/nxshock/logwriter"
|
2022-03-26 13:23:39 +05:00
|
|
|
)
|
|
|
|
|
2022-05-14 14:17:30 +05:00
|
|
|
type LogWriter struct{ w *logwriter.LogWriter }
|
2022-05-11 18:59:33 +05:00
|
|
|
|
2022-05-14 14:17:30 +05:00
|
|
|
func (lw *LogWriter) Printf(format string, v ...interface{}) {
|
|
|
|
lw.w.Printf(format, v...)
|
2022-05-11 18:59:33 +05:00
|
|
|
}
|
|
|
|
|
2022-05-14 14:17:30 +05:00
|
|
|
func (lw *LogWriter) Println(v ...interface{}) {
|
|
|
|
lw.w.Println(v...)
|
2022-05-11 18:59:33 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
var mainLogFile *os.File
|
2022-03-26 13:23:39 +05:00
|
|
|
|
2022-03-27 12:39:24 +05:00
|
|
|
func initLogFile() error {
|
2022-03-26 13:23:39 +05:00
|
|
|
var err error
|
2022-05-11 18:59:33 +05:00
|
|
|
mainLogFile, err = os.OpenFile(config.LogFilePath, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644)
|
2022-03-27 12:39:24 +05:00
|
|
|
|
|
|
|
return err
|
2022-03-26 13:23:39 +05:00
|
|
|
}
|