2013-12-15 11:43:31 +01:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
2014-01-13 18:29:23 +01:00
|
|
|
// set in main()
|
|
|
|
var logger *log.Logger
|
2013-12-15 11:43:31 +01:00
|
|
|
|
|
|
|
func debugln(vals ...interface{}) {
|
2013-12-31 03:21:31 +01:00
|
|
|
s := fmt.Sprintln(vals...)
|
|
|
|
logger.Output(2, "DEBUG: "+s)
|
2013-12-15 11:43:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func debugf(format string, vals ...interface{}) {
|
2013-12-31 03:21:31 +01:00
|
|
|
s := fmt.Sprintf(format, vals...)
|
|
|
|
logger.Output(2, "DEBUG: "+s)
|
2013-12-15 11:43:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func infoln(vals ...interface{}) {
|
|
|
|
s := fmt.Sprintln(vals...)
|
|
|
|
logger.Output(2, "INFO: "+s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func infof(format string, vals ...interface{}) {
|
|
|
|
s := fmt.Sprintf(format, vals...)
|
|
|
|
logger.Output(2, "INFO: "+s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func okln(vals ...interface{}) {
|
|
|
|
s := fmt.Sprintln(vals...)
|
|
|
|
logger.Output(2, "OK: "+s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func okf(format string, vals ...interface{}) {
|
|
|
|
s := fmt.Sprintf(format, vals...)
|
|
|
|
logger.Output(2, "OK: "+s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func warnln(vals ...interface{}) {
|
|
|
|
s := fmt.Sprintln(vals...)
|
2014-02-12 23:18:41 +01:00
|
|
|
showGuiError(s)
|
2013-12-15 11:43:31 +01:00
|
|
|
logger.Output(2, "WARNING: "+s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func warnf(format string, vals ...interface{}) {
|
|
|
|
s := fmt.Sprintf(format, vals...)
|
2014-02-12 23:18:41 +01:00
|
|
|
showGuiError(s)
|
2013-12-15 11:43:31 +01:00
|
|
|
logger.Output(2, "WARNING: "+s)
|
|
|
|
}
|
|
|
|
|
|
|
|
func fatalln(vals ...interface{}) {
|
|
|
|
s := fmt.Sprintln(vals...)
|
|
|
|
logger.Output(2, "FATAL: "+s)
|
|
|
|
os.Exit(3)
|
|
|
|
}
|
|
|
|
|
|
|
|
func fatalf(format string, vals ...interface{}) {
|
|
|
|
s := fmt.Sprintf(format, vals...)
|
|
|
|
logger.Output(2, "FATAL: "+s)
|
|
|
|
os.Exit(3)
|
|
|
|
}
|
|
|
|
|
|
|
|
func fatalErr(err error) {
|
|
|
|
if err != nil {
|
|
|
|
fatalf(err.Error())
|
|
|
|
}
|
|
|
|
}
|