proxy-detector/log/file.go

21 lines
360 B
Go
Raw Permalink Normal View History

package log
import (
"os"
"path/filepath"
)
var (
logDir = "/var/log/proxy-detector"
logFile = filepath.Join(logDir, "run.log")
)
func initFile(path string) *os.File {
// TODO detect old log files and compress
f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE, 0755)
if err != nil {
Errorln("get log file error: %s", err.Error())
}
return f
}