package logger import ( "io" "log" "os" ) var ( Debug *log.Logger Info *log.Logger Error *log.Logger ) func Init( debugHandle io.Writer, infoHandle io.Writer, errorHandle io.Writer) { Debug = log.New(debugHandle, "DEBUG: ", log.Ldate|log.Ltime|log.Lshortfile) Info = log.New(infoHandle, "INFO: ", log.Ldate|log.Ltime|log.Lshortfile) Error = log.New(errorHandle, "ERROR: ", log.Ldate|log.Ltime|log.Lshortfile) } func CreateLogFile(path string) *os.File { f, err := os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) if err != nil { log.Println(err) } return f }