mirror of
https://github.com/nxshock/gron.git
synced 2024-11-27 03:41:00 +05:00
Add LogWriter
to add timestamps for job logs
This commit is contained in:
parent
410722bc13
commit
1cbca5b0e3
13
log.go
13
log.go
@ -1,18 +1,19 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/nxshock/logwriter"
|
||||||
)
|
)
|
||||||
|
|
||||||
type logFile struct{ file *os.File }
|
type LogWriter struct{ w *logwriter.LogWriter }
|
||||||
|
|
||||||
func (lf *logFile) Printf(format string, v ...interface{}) {
|
func (lw *LogWriter) Printf(format string, v ...interface{}) {
|
||||||
fmt.Fprintf(lf.file, format, v...)
|
lw.w.Printf(format, v...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (lf *logFile) Println(v ...interface{}) {
|
func (lw *LogWriter) Println(v ...interface{}) {
|
||||||
fmt.Fprintln(lf.file, v...)
|
lw.w.Println(v...)
|
||||||
}
|
}
|
||||||
|
|
||||||
var mainLogFile *os.File
|
var mainLogFile *os.File
|
||||||
|
Loading…
Reference in New Issue
Block a user