Ejemplo n.º 1
0
func SetupLogging(loggingLevel, logFile string) {
	level := log.DEBUG
	switch loggingLevel {
	case "info":
		level = log.INFO
	case "warn":
		level = log.WARNING
	case "error":
		level = log.ERROR
	}

	log.Global = make(map[string]*log.Filter)
	Global = log.Global
	if logFile == "stdout" || logFile == "" {
		flw := log.NewConsoleLogWriter()
		log.AddFilter("stdout", level, flw)
	} else if logFile == "stderr" || logFile == "" {
		flw := log.NewConsoleLogWriter()
		log.AddFilter("stderr", level, flw)
	} else {
		logFileDir := filepath.Dir(logFile)
		os.MkdirAll(logFileDir, 0744)

		flw := log.NewFileLogWriter(logFile, false)
		log.AddFilter("file", level, flw)

		flw.SetFormat("[%D %T] [%L] (%S) %M")
		flw.SetRotate(true)
		flw.SetRotateSize(0)
		flw.SetRotateLines(0)
		flw.SetRotateDaily(true)
	}

	Global.Info("Redirectoring logging to %s %s", logFile, level)
}
Ejemplo n.º 2
0
func setupLogging(loggingLevel, logFile string) {
	level := log.DEBUG
	switch loggingLevel {
	case "info":
		level = log.INFO
	case "warn":
		level = log.WARNING
	case "error":
		level = log.ERROR
	}

	for _, filter := range log.Global {
		filter.Level = level
	}

	if logFile == "stdout" {
		log.AddFilter("stdout", level, log.NewConsoleLogWriter())
	} else {
		logDir := filepath.Dir(logFile)
		if err := os.MkdirAll(logDir, 0744); err != nil {
			panic(err)
		}

		writer := log.NewFileLogWriter(logFile, false)
		log.AddFilter("file", level, writer)
		writer.SetFormat("[%D %t] [%L] (%S) %M")
		writer.SetRotate(true)
		writer.SetRotateSize(0)
		writer.SetRotateLines(0)
		writer.SetRotateDaily(true)
	}
}
Ejemplo n.º 3
0
func setupLogging(loggingLevel, logFile string) {
	level := log.DEBUG
	switch loggingLevel {
	case "fine":
		level = log.FINE
	case "debug":
		level = log.DEBUG
	case "info":
		level = log.INFO
	case "warn":
		level = log.WARNING
	case "error":
		level = log.ERROR
	default:
		log.Error("Unknown log level %s. Defaulting to DEBUG", loggingLevel)
	}

	log.Global = make(map[string]*log.Filter)

	facility, ok := GetSysLogFacility(logFile)
	if ok {
		flw, err := NewSysLogWriter(facility)
		if err != nil {
			fmt.Fprintf(os.Stderr, "NewSysLogWriter: %s\n", err.Error())
			return
		}
		log.AddFilter("syslog", level, flw)
	} else if logFile == "stdout" {
		flw := log.NewConsoleLogWriter()
		log.AddFilter("stdout", level, flw)
	} else {
		logFileDir := filepath.Dir(logFile)
		os.MkdirAll(logFileDir, 0744)

		flw := log.NewFileLogWriter(logFile, false)
		if flw == nil {
			os.Exit(1)
		}
		log.AddFilter("file", level, flw)

		flw.SetFormat("[%D %T] [%L] (%S) %M")
		flw.SetRotate(true)
		flw.SetRotateSize(0)
		flw.SetRotateLines(0)
		flw.SetRotateDaily(true)
	}

	log.Info("Redirectoring logging to %s", logFile)
}
Ejemplo n.º 4
0
Archivo: main.go Proyecto: ochz/lime
func main() {
	flag.Parse()

	log4go.AddFilter("file", log4go.FINEST, log4go.NewFileLogWriter("debug.log", *rotateLog))
	defer func() {
		py.NewLock()
		py.Finalize()
	}()

	if err := termbox.Init(); err != nil {
		log4go.Exit(err)
	}
	defer func() {
		termbox.Close()
		log4go.Debug(util.Prof)
		if err := recover(); err != nil {
			log4go.Crash(err)
		}
	}()

	var t tbfe
	t.dorender = make(chan bool, render_chan_len)
	t.layout = make(map[*backend.View]layout)
	t.loop()
}
Ejemplo n.º 5
0
func main() {

	// Set the static directory for webgo
	path := os.Getenv("GOPATH")
	if path == "" {
		fmt.Println("GOPATH NOT SET")
		return
	}
	filepath := fmt.Sprintf("%s/../frontend/src/", path)
	web.Config.StaticDir = filepath

	// Setup logging
	log := make(l4g.Logger)
	// Create a default logger that is logging messages of FINE or higher
	l4g.AddFilter("file", l4g.FINE, l4g.NewFileLogWriter("error_log.log", false))
	log.Close()

	// Setup the DB
	db.Init(path)

	// Parse command line arguments
	port := flag.Int("port", 80, "port number to start the server on")
	flag.Parse()
	url := fmt.Sprintf("0.0.0.0:%d", *port)

	// Start the server!
	serve.Routes()
	web.Run(url)
}
Ejemplo n.º 6
0
func setupLogging(loggingLevel, logFile string) {
	level := log.DEBUG
	switch loggingLevel {
	case "info":
		level = log.INFO
	case "warn":
		level = log.WARNING
	case "error":
		level = log.ERROR
	}

	for _, filter := range log.Global {
		filter.Level = level
	}

	logFileDir := filepath.Dir(logFile)
	os.MkdirAll(logFileDir, 0744)

	flw := log.NewFileLogWriter(logFile, false)
	flw.SetFormat("[%D %T] [%L] (%S) %M")
	flw.SetRotate(true)
	flw.SetRotateSize(0)
	flw.SetRotateLines(0)
	flw.SetRotateDaily(true)
	log.AddFilter("file", level, flw)
	log.Info("Redirectoring logging to %s", logFile)
}
Ejemplo n.º 7
0
func main() {
	l4g.AddFilter("stdout", l4g.WARNING, l4g.NewConsoleLogWriter())

	if len(os.Args) < 2 {
		printUsage()
	} else {
		discover := goupnp.DiscoverIGD()
		if os.Args[1] == "s" {
			igd := <-discover
			status := <-igd.GetConnectionStatus()
			fmt.Printf("%+v\n", status)
		} else if os.Args[1] == "l" {
			igd := <-discover
			for portMapping := range igd.ListRedirections() {
				fmt.Println(portMapping)
			}
		} else if os.Args[1] == "a" {
			igd := <-discover
			port, _ := strconv.Atoi(os.Args[2])
			proto := goupnp.ParseProtocol(os.Args[3])
			myMapping := <-igd.AddLocalPortRedirection(uint16(port), proto)
			fmt.Printf("%+v\n", myMapping)
		} else {
			printUsage()
		}
	}

	time.Sleep(1 * time.Second)
}
Ejemplo n.º 8
0
func setLogOutput() {
	_, err := os.OpenFile(tywa.LOG_FILE, os.O_RDWR, 0666)
	if err != nil {
		fmt.Println("Unable to open log file. Reason: ", err)
	} else {
		log.AddFilter("file", log.FINE, log.NewFileLogWriter(tywa.LOG_FILE, false))
	}
}
Ejemplo n.º 9
0
func init() {
	// Tests outside of config_test.go also require this configuration to be
	// loaded; Config tests should reset it by making this call
	loadTestConfig("test-walker.yaml")

	// For tests it's useful to see more than the default INFO
	log4go.AddFilter("stdout", log4go.DEBUG, log4go.NewConsoleLogWriter())
}
Ejemplo n.º 10
0
func main() {
	log4go.AddFilter("file", log4go.FINEST, log4go.NewConsoleLogWriter())
	defer func() {
		py.NewLock()
		py.Finalize()
	}()

	t = &qmlfrontend{windows: make(map[*backend.Window]*frontendWindow)}
	go t.qmlBatchLoop()
	qml.Run(t.loop)
}
Ejemplo n.º 11
0
func configureLog(s *model.LogSettings) {

	l4g.Close()

	if s.EnableConsole {
		level := l4g.DEBUG
		if s.ConsoleLevel == "INFO" {
			level = l4g.INFO
		} else if s.ConsoleLevel == "WARN" {
			level = l4g.WARNING
		} else if s.ConsoleLevel == "ERROR" {
			level = l4g.ERROR
		}

		l4g.AddFilter("stdout", level, l4g.NewConsoleLogWriter())
	}

	if s.EnableFile {

		var fileFormat = s.FileFormat

		if fileFormat == "" {
			fileFormat = "[%D %T] [%L] %M"
		}

		level := l4g.DEBUG
		if s.FileLevel == "INFO" {
			level = l4g.INFO
		} else if s.FileLevel == "WARN" {
			level = l4g.WARNING
		} else if s.FileLevel == "ERROR" {
			level = l4g.ERROR
		}

		flw := l4g.NewFileLogWriter(GetLogFileLocation(s.FileLocation), false)
		flw.SetFormat(fileFormat)
		flw.SetRotate(true)
		flw.SetRotateLines(LOG_ROTATE_SIZE)
		l4g.AddFilter("file", level, flw)
	}
}
Ejemplo n.º 12
0
func main() {
	log4go.AddFilter("file", log4go.FINEST, log4go.NewConsoleLogWriter())
	defer func() {
		py.NewLock()
		py.Finalize()
	}()

	var t tbfe
	t.layout = make(map[*backend.View]layout)
	t.views = make(map[*backend.View]*frontendView)
	t.loop()
}
Ejemplo n.º 13
0
// init sets the default log4go configuration and attempts to read a log4go.xml
// file if available
func init() {
	log4go.AddFilter("stdout", log4go.INFO, log4go.NewConsoleLogWriter())
	loadLog4goConfig()
	sig := make(chan os.Signal)
	signal.Notify(sig, syscall.SIGHUP)
	go func() {
		for {
			<-sig
			loadLog4goConfig()
		}
	}()
}
Ejemplo n.º 14
0
func setup_logger() {
	filename := "/var/log/ranger/ranger.log"

	// Create a default logger that is logging messages of FINE or higher to filename, no rotation
	//    log.AddFilter("file", l4g.FINE, l4g.NewFileLogWriter(filename, false))

	// =OR= Can also specify manually via the following: (these are the defaults, this is equivalent to above)
	flw := l4g.NewFileLogWriter(filename, false)
	if flw == nil {
		fmt.Printf("No permission to write to %s, going to switch to stdout only\n", filename)
	} else {
		flw.SetFormat("[%D %T] [%L] (%S) %M")
		flw.SetRotate(false)
		flw.SetRotateSize(0)
		flw.SetRotateLines(0)
		flw.SetRotateDaily(true)
		l4g.AddFilter("file", l4g.DEBUG, flw)

		l4g.AddFilter("stdout", l4g.ERROR, l4g.NewConsoleLogWriter())
	}
}
Ejemplo n.º 15
0
func main() {
	log4go.AddFilter("file", log4go.FINEST, log4go.NewConsoleLogWriter())
	defer func() {
		py.NewLock()
		py.Finalize()
	}()

	var t tbfe
	t.dorender = make(chan bool, render_chan_len)
	t.layout = make(map[*backend.View]layout)
	t.loop()
}
Ejemplo n.º 16
0
func configureLog(s LogSettings) {

	l4g.Close()

	if s.ConsoleEnable {
		level := l4g.DEBUG
		if s.ConsoleLevel == "INFO" {
			level = l4g.INFO
		} else if s.ConsoleLevel == "ERROR" {
			level = l4g.ERROR
		}

		l4g.AddFilter("stdout", level, l4g.NewConsoleLogWriter())
	}

	if s.FileEnable {
		if s.FileFormat == "" {
			s.FileFormat = "[%D %T] [%L] %M"
		}

		if s.FileLocation == "" {
			s.FileLocation = FindDir("logs") + "mattermost.log"
		}

		level := l4g.DEBUG
		if s.FileLevel == "INFO" {
			level = l4g.INFO
		} else if s.FileLevel == "ERROR" {
			level = l4g.ERROR
		}

		flw := l4g.NewFileLogWriter(s.FileLocation, false)
		flw.SetFormat(s.FileFormat)
		flw.SetRotate(true)
		flw.SetRotateLines(100000)
		l4g.AddFilter("file", level, flw)
	}
}
Ejemplo n.º 17
0
func main() {
	// Need to lock the OS thread as OSX GUI requires GUI stuff to run in the main thread
	runtime.LockOSThread()

	log4go.AddFilter("file", log4go.FINEST, log4go.NewConsoleLogWriter())
	defer func() {
		py.NewLock()
		py.Finalize()
	}()

	t = &qmlfrontend{windows: make(map[*backend.Window]*frontendWindow)}
	go t.qmlBatchLoop()
	qml.Run(t.loop)
}
Ejemplo n.º 18
0
func setupLogging(loggingLevel, logFile string) {
	level := log.DEBUG
	switch loggingLevel {
	case "TRACE":
		level = log.TRACE
	case "DEBUG":
		level = log.DEBUG
	case "INFO":
		level = log.INFO
	case "WARN":
		level = log.WARNING
	case "ERROR":
		level = log.ERROR
	}

	log.Global = make(map[string]*log.Filter)

	if logFile == "stdout" {
		flw := log.NewConsoleLogWriter()
		log.AddFilter("stdout", level, flw)

	} else {
		logFileDir := filepath.Dir(logFile)
		os.MkdirAll(logFileDir, 0744)

		flw := log.NewFileLogWriter(logFile, false)
		log.AddFilter("file", level, flw)

		flw.SetFormat("[%D %T] [%L] (%S) %M")
		flw.SetRotate(true)
		flw.SetRotateSize(0)
		flw.SetRotateLines(0)
		flw.SetRotateDaily(true)
	}

	log.Info("Redirectoring logging to %s", logFile)
}
Ejemplo n.º 19
0
func main() {
	log4go.AddFilter("file", log4go.FINEST, log4go.NewFileLogWriter("debug.log", true))
	defer func() {
		py.NewLock()
		py.Finalize()
	}()

	if err := termbox.Init(); err != nil {
		log4go.Exit(err)
	}

	var t tbfe
	t.dorender = make(chan bool, render_chan_len)
	t.layout = make(map[*backend.View]layout)
	go t.renderthread()
	t.loop()
}
Ejemplo n.º 20
0
Archivo: dht.go Proyecto: rakoo/dht
func init() {
	flag.StringVar(&dhtRouters, "routers", "1.a.magnets.im:6881,router.utorrent.com:6881",
		"Comma separated IP:Port address of the DHT routeirs used to bootstrap the DHT network.")
	flag.IntVar(&maxNodes, "maxNodes", 500,
		"Maximum number of nodes to store in the routing table, in memory. This is the primary configuration for how noisy or aggressive this node should be. When the node starts, it will try to reach maxNodes/2 as quick as possible, to form a healthy routing table.")
	flag.DurationVar(&cleanupPeriod, "cleanupPeriod", 15*time.Minute,
		"How often to ping nodes in the network to see if they are reachable.")
	flag.DurationVar(&savePeriod, "savePeriod", 5*time.Minute,
		"How often to save the routing table to disk.")
	flag.Int64Var(&rateLimit, "rateLimit", 100,
		"Maximum packets per second to be processed. Beyond this limit they are silently dropped. Set to -1 to disable rate limiting.")

	// TODO: Control the verbosity via flag.
	// Setting during init has two purposes:
	// - Gives the calling program the ability to override this filter inside their main().
	// - Provides a sane default that isn't excessively verbose.
	l4g.AddFilter("stdout", l4g.WARNING, l4g.NewConsoleLogWriter())
}
Ejemplo n.º 21
0
Archivo: dht.go Proyecto: screscent/dht
func init() {
	// TODO: Run my own router.
	flag.StringVar(&dhtRouter, "dhtRouter", "router.utorrent.com:6881",
		"IP:Port address of the DHT router used to bootstrap the DHT network.")
	flag.IntVar(&maxNodes, "maxNodes", 1000,
		"Maximum number of nodes to store in the routing table, in memory.")
	flag.DurationVar(&cleanupPeriod, "cleanupPeriod", 15*time.Minute,
		"How often to ping nodes in the network to see if they are reachable.")
	flag.DurationVar(&savePeriod, "savePeriod", 5*time.Minute,
		"How often to save the routing table to disk.")
	flag.Int64Var(&rateLimit, "rateLimit", 100,
		"Maximum packets per second to be processed. Beyond this limit they are silently dropped. Set to -1 to disable rate limiting.")

	// TODO: Control the verbosity via flag.
	// Setting during init has two purposes:
	// - Gives the calling program the ability to override this filter inside their main().
	// - Provides a sane default that isn't excessively verbose.
	l4g.AddFilter("stdout", l4g.WARNING, l4g.NewConsoleLogWriter())
}
Ejemplo n.º 22
0
Archivo: main.go Proyecto: nhelke/dht
func main() {
	flag.Parse()
	// Change to l4g.DEBUG to see *lots* of debugging information.
	l4g.AddFilter("stdout", l4g.WARNING, l4g.NewConsoleLogWriter())
	if len(flag.Args()) != 1 {
		fmt.Fprintf(os.Stderr, "Usage: %v <infohash>\n\n", os.Args[0])
		fmt.Fprintf(os.Stderr, "Example infohash: d1c5676ae7ac98e8b19f63565905105e3c4c37a2\n")
		flag.PrintDefaults()
		os.Exit(1)
	}
	ih, err := dht.DecodeInfoHash(flag.Args()[0])
	if err != nil {
		l4g.Critical("DecodeInfoHash error: %v\n", err)
		os.Exit(1)
	}

	// This is a hint to the DHT of the minimum number of peers it will try to
	// find for the given node. This is not a reliable limit. In the future this
	// might be moved to "PeersRequest()", so the controlling client can have
	// different targets at different moments or for different infohashes.
	targetNumPeers := 5
	d, err := dht.NewDHTNode(dhtPortUDP, targetNumPeers, false)
	if err != nil {
		l4g.Critical("NewDHTNode error: %v", err)
		os.Exit(1)

	}
	// For debugging.
	go http.ListenAndServe(fmt.Sprintf(":%d", httpPortTCP), nil)

	go d.DoDHT()
	go drainresults(d)

	for {
		// Give the DHT some time to "warm-up" its routing table.
		time.Sleep(5 * time.Second)

		d.PeersRequest(string(ih), false)
	}
}
func main() {
	screen.FillRect(nil, bgcolor)
	go ui_main()

	///////////////////////////////////////////////////////////////
	///////////////////////////////////////////////////////////////
	///////////////////////////////////////////////////////////////

	flw := l4g.NewFileLogWriter("/tmp/golog.log", false)
	flw.SetFormat("[%D %T] [%L] GOMANAGER : %M ")
	flw.SetRotate(false)
	flw.SetRotateSize(0)
	flw.SetRotateLines(0)
	flw.SetRotateDaily(false)
	l4g.AddFilter("file", l4g.FINE, flw)
	l4g.Info(" --- START GOMANAGER ---")
	writeSDLstr(" --- START GOMANAGER ---")

	c, err := NewConsumer(*uri, *exchange, *exchangeType, *queue, *bindingKey, *consumerTag)
	if err != nil {
		log.Fatalf("%s", err)
	}

	if *lifetime > 0 {
		l4g.Info("running for %s", *lifetime)
		time.Sleep(*lifetime)
	} else {
		l4g.Info("running forever")
		writeSDLstr("running forever")
		select {}
	}

	l4g.Info("shutting down")

	if err := c.Shutdown(); err != nil {
		log.Fatalf("error during shutdown: %s", err)
	}

}
Ejemplo n.º 24
0
func main() {
	py.InitializeEx(false)
	defer py.Finalize()
	e := backend.GetEditor()
	log4go.AddFilter("stdout", log4go.DEBUG, log4go.NewConsoleLogWriter())

	if sc, err := textmate.LoadTheme("../../3rdparty/bundles/TextMate-Themes/GlitterBomb.tmTheme"); err != nil {
		log4go.Error(err)
	} else {
		scheme = sc
		log4go.Debug("scheme: %v", scheme)
	}

	backend.OnNewWindow.Add(new_window)
	backend.OnNew.Add(new_view)
	backend.OnModified.Add(view_modified)
	go e.Init()
	qt5.Main(func() {
		w := e.NewWindow()
		w.OpenFile("main.go", 0)
		w.OpenFile("../../backend/editor.go", 0)
		qt5.Run()
	})
}
Ejemplo n.º 25
0
Archivo: env.go Proyecto: Hi-Rube/spore
func init() {
	runtime.GOMAXPROCS(runtime.NumCPU())
	l4g.AddFilter("stdout", l4g.INFO, l4g.NewConsoleLogWriter())
	l4g.AddFilter("logfile", l4g.DEBUG, l4g.NewFileLogWriter("spored.log", false))
}
Ejemplo n.º 26
0
func init() {
	log4go.AddFilter("stdout", log4go.WARNING, log4go.NewConsoleLogWriter())
}
Ejemplo n.º 27
0
func main() {

	if len(os.Args) == 1 {
		print_usage()
		os.Exit(1)
	}
	var input_hash = os.Args[1]
	var input_component = os.Args[2]
	var resultVersion int

	// establish logging
	logFile := log.NewFileLogWriter("/usr/local/versionforhash/log/versionforhash.log", false)
	logFile.SetRotate(true)
	logFile.SetRotateDaily(true)

	log.AddFilter("stdout", log.CRITICAL, log.NewConsoleLogWriter())
	log.AddFilter("file", log.FINE, logFile)

	db := "/usr/local/versionforhash/db/versions.db"

	conn, err := sql.Open("sqlite3", db)
	if err != nil {
		log.Error("Unable to open the database: %s", err)
	}
	defer conn.Close()

	createSql := `CREATE TABLE versions(id INTEGER PRIMARY KEY AUTOINCREMENT, version INTEGER, hash TEXT, component VARCHAR(255), created TEXT, UNIQUE(hash, component) ON CONFLICT ABORT);`

	conn.Exec(createSql)

	// first check that we have the exact combination in the database. If so, return the verison
	err = conn.QueryRow("SELECT version FROM versions WHERE component = ? AND hash = ?", input_component, input_hash).Scan(&resultVersion)
	switch {
	case err == sql.ErrNoRows:
		log.Debug("No rows exist for %v@%v", input_component, input_hash)
	case err != nil:
		log.Error(err)
	default:
		log.Debug("Returning result: %v for %v@%v", resultVersion, input_component, input_hash)
		fmt.Println(resultVersion)
		return
	}

	// We could not find the exact combination in the databse so we will generate a new version based on the count of existing references to component
	var recordCount int
	err = conn.QueryRow("SELECT count(component) FROM versions WHERE component = ?", input_component).Scan(&recordCount)
	switch {
	case err == sql.ErrNoRows:
		// this should never get triggered. A COUNT query will return 0 if nothing is found
		log.Error("Could not count component %v", input_component)
	case err != nil:
		// this would catch something odd
		log.Error(err)
	default:
		resultVersion = recordCount + 1
		log.Debug("Count was %v. Setting nextVersion to %v for %v@%v\n", recordCount, resultVersion, input_component, input_hash)
	}

	tx, err := conn.Begin()
	if err != nil {
		log.Error(err)
		return
	}
	stmt, err := tx.Prepare("INSERT INTO versions(version, hash, component, created) VALUES (?,?,?,?)")
	if err != nil {
		log.Error(err)
	}
	_, err = stmt.Exec(resultVersion, input_hash, input_component, time.Now())
	if err != nil {
		log.Error(err)
		return
	}
	tx.Commit()
	log.Debug("Returning version %v for %v@%v", resultVersion, input_component, input_hash)
	fmt.Println(resultVersion)
}
Ejemplo n.º 28
0
func main() {
	var numTargetPeers int
	var sendAnnouncements bool
	var file *os.File
	var num int
	var shalist [64]string
	var err error
	var part []byte

	l4g.AddFilter("stdout", l4g.DEBUG, l4g.NewConsoleLogWriter())

	if file, err = os.Open("hops.log"); err != nil {
		return
	}
	reader := bufio.NewReader(file)
	num = 0
	for {
		if part, _, err = reader.ReadLine(); err != nil {
			break
		}
		if err == io.EOF {
			err = nil
		}
		hasher := sha1.New()
		hasher.Write(part)
		shalist[num] = string(hasher.Sum(nil))
		num = num + 1
	}

	sendAnnouncements = true
	numTargetPeers = 64

	port := 42345
	l4g.Error("used port %d", port)
	dht, err := dht.NewDHTNode(port, numTargetPeers, false)
	if err != nil {
		l4g.Error("DHT node creation error", err)
		return
	}

	go dht.DoDHT()
	go drainresults(dht)

	queryTick := time.Tick(20 * time.Second)

	go http.ListenAndServe(fmt.Sprintf(":%d", httpPort), nil)
	for {
		select {
		case <-queryTick:
			// trying the manual method from dht_test in case I have the format
			// wrong
			fmt.Printf("TICK ************************************\n")
			fmt.Printf("TICK ************************************\n")
			fmt.Printf("TICK ************************************\n")
			fmt.Printf("TICK ************************************\n")
			fmt.Printf("TICK ************************************\n")
			fmt.Printf("TICK ************************************\n")
			for i := 0; i < num; i++ {
				l4g.Info("querying for infoHash: %x", shalist[i])
				dht.PeersRequest(shalist[i], sendAnnouncements)
				time.Sleep(10 * time.Second)
			}
		}
	}
}
Ejemplo n.º 29
0
func init() {
	log4go.Close()
	log4go.AddFilter("test", log4go.DEBUG, log4go.NewConsoleLogWriter())
}