Something went wrong. Try again.
Fork of micro-editor/micro
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132package main
import ( "log" "os"
"github.com/micro-editor/micro/v2/internal/util")
// NullWriter simply sends writes into the voidtype NullWriter struct{}
// Write is emptyfunc (NullWriter) Write(data []byte) (n int, err error) { return 0, nil}
// InitLog sets up the debug log system for micro if it has been enabled by compile-time variablesfunc InitLog() { if util.Debug == "ON" { f, err := os.OpenFile("log.txt", os.O_RDWR|os.O_CREATE|os.O_TRUNC, util.FileMode) if err != nil { log.Fatalf("error opening file: %v", err) }
log.SetOutput(f) log.Println("Micro started") } else { log.SetOutput(NullWriter{}) }}