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
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"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{}) {
|
||||
fmt.Fprintf(lf.file, format, v...)
|
||||
func (lw *LogWriter) Printf(format string, v ...interface{}) {
|
||||
lw.w.Printf(format, v...)
|
||||
}
|
||||
|
||||
func (lf *logFile) Println(v ...interface{}) {
|
||||
fmt.Fprintln(lf.file, v...)
|
||||
func (lw *LogWriter) Println(v ...interface{}) {
|
||||
lw.w.Println(v...)
|
||||
}
|
||||
|
||||
var mainLogFile *os.File
|
||||
|
Loading…
Reference in New Issue
Block a user