Initialize logging earlier (fix panic in tests)

This commit is contained in:
Jakob Borg 2014-02-13 08:50:19 +01:00
parent 91d5c4a1ae
commit 6c8135126d
2 changed files with 5 additions and 4 deletions

View File

@ -6,9 +6,13 @@ import (
"os"
)
// set in main()
var logger *log.Logger
func init() {
log.SetOutput(os.Stderr)
logger = log.New(os.Stderr, "", log.Flags())
}
func debugln(vals ...interface{}) {
s := fmt.Sprintln(vals...)
logger.Output(2, "DEBUG: "+s)

View File

@ -40,9 +40,6 @@ var (
)
func main() {
log.SetOutput(os.Stderr)
logger = log.New(os.Stderr, "", log.Flags())
flag.StringVar(&confDir, "home", "~/.syncthing", "Set configuration directory")
flag.StringVar(&trace, "debug.trace", "", "(connect,net,idx,file,pull)")
flag.StringVar(&profiler, "debug.profiler", "", "(addr)")