mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-14 01:04:14 +00:00
Initialize logging earlier (fix panic in tests)
This commit is contained in:
parent
91d5c4a1ae
commit
6c8135126d
@ -6,9 +6,13 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
)
|
)
|
||||||
|
|
||||||
// set in main()
|
|
||||||
var logger *log.Logger
|
var logger *log.Logger
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
log.SetOutput(os.Stderr)
|
||||||
|
logger = log.New(os.Stderr, "", log.Flags())
|
||||||
|
}
|
||||||
|
|
||||||
func debugln(vals ...interface{}) {
|
func debugln(vals ...interface{}) {
|
||||||
s := fmt.Sprintln(vals...)
|
s := fmt.Sprintln(vals...)
|
||||||
logger.Output(2, "DEBUG: "+s)
|
logger.Output(2, "DEBUG: "+s)
|
||||||
|
3
main.go
3
main.go
@ -40,9 +40,6 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
log.SetOutput(os.Stderr)
|
|
||||||
logger = log.New(os.Stderr, "", log.Flags())
|
|
||||||
|
|
||||||
flag.StringVar(&confDir, "home", "~/.syncthing", "Set configuration directory")
|
flag.StringVar(&confDir, "home", "~/.syncthing", "Set configuration directory")
|
||||||
flag.StringVar(&trace, "debug.trace", "", "(connect,net,idx,file,pull)")
|
flag.StringVar(&trace, "debug.trace", "", "(connect,net,idx,file,pull)")
|
||||||
flag.StringVar(&profiler, "debug.profiler", "", "(addr)")
|
flag.StringVar(&profiler, "debug.profiler", "", "(addr)")
|
||||||
|
Loading…
Reference in New Issue
Block a user