wikingo/server/log.go

21 lines
298 B
Go
Raw Normal View History

2022-03-28 21:11:10 +02:00
package server
import (
"io"
"log"
"os"
)
var (
Debug *log.Logger
)
func InitLogger(debug bool) {
// Discard policy by default
Debug = log.New(io.Discard, "", 0)
// Enable it only if debug flag was passed
if debug {
Debug = log.New(os.Stderr, "DEBUG: ", log.Ltime|log.Lshortfile)
}
}