當前位置: 首頁>>代碼示例>>Golang>>正文


Golang seelog.Debug函數代碼示例

本文整理匯總了Golang中github.com/cihub/seelog.Debug函數的典型用法代碼示例。如果您正苦於以下問題:Golang Debug函數的具體用法?Golang Debug怎麽用?Golang Debug使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Debug函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: Show

func (mqtt *Mqtt) Show() {
	if mqtt.FixedHeader != nil {
		mqtt.FixedHeader.Show()
	} else {
		log.Debug("Fixed header is nil")
	}

	if mqtt.ConnectFlags != nil {
		mqtt.ConnectFlags.Show()
	} else {
		log.Debug("ConnectFlags is nil")
	}

	fmt.Println("ProtocolName:", mqtt.ProtocolName)
	fmt.Println("Version:", mqtt.ProtocolVersion)
	fmt.Println("TopicName:", mqtt.TopicName)
	fmt.Println("ClientId:", mqtt.ClientId)
	fmt.Println("WillTopic:", mqtt.WillTopic)
	fmt.Println("WillMessage:", mqtt.WillMessage)
	fmt.Println("Username:", mqtt.Username)
	fmt.Println("Password:", mqtt.Password)
	fmt.Println("KeepAliveTimer:", mqtt.KeepAliveTimer)
	fmt.Println("MessageId:", mqtt.MessageId)

	fmt.Println("Data:", mqtt.Data)
	fmt.Println("Topics:", len(mqtt.Topics))
	for i := 0; i < len(mqtt.Topics); i++ {
		fmt.Printf("(%s) (qos=%d)\n", mqtt.Topics[i], mqtt.Topics_qos[i])
	}
	fmt.Println("ReturnCode:", mqtt.ReturnCode)
}
開發者ID:RouGang,項目名稱:gossipd,代碼行數:31,代碼來源:mqtt.go

示例2: Mouse

// mouse handler
func (win *Window) Mouse(x int, y int, deltaX int, deltaY int, flags uint16) {

	// drag only if clicked inside titlebar. checking Y position is enough, because X will be inside the window bounds anyway
	if !win.tbHidden && win.Element.Y+deltaY <= y && y <= win.Element.Y+deltaY+win.titleBarHeight {

		if (flags & mouse.F_L_CLICK) != 0 {
			log.Debug("Window ms handler: click")
			win.wasClicked = true
		} else if win.wasClicked && (flags&mouse.F_L_HOLD) != 0 {
			log.Debug("Window ms handler: drag")
			win.Element.X += deltaX
			win.Element.Y += deltaY
			win.Element.ScreenX += deltaX
			win.Element.ScreenY += deltaY

			// update screen position for all the children
			for v := win.Children.Front(); v != nil; v = v.Next() {
				v.Value.(base.IElement).UpdateScreenX(deltaX)
				v.Value.(base.IElement).UpdateScreenY(deltaY)
			}
		} else if (flags & mouse.F_L_DBL_CLICK) != 0 {
			log.Debug("Window ms handler: double click")
		} else {
			log.Debug("Window ms handler: title do nothing...")
			win.wasClicked = false
		}
	}
}
開發者ID:romovs,項目名稱:viscum,代碼行數:29,代碼來源:window.go

示例3: printSorted

func printSorted(msg string, paths []FieldPath) {
	log.Debug("paths")
	sort.Sort(FieldPaths(paths))
	for _, p := range paths {
		log.Debug("  ", p)
	}
}
開發者ID:oldenbur,項目名稱:gostree,代碼行數:7,代碼來源:fieldpath_test.go

示例4: Mouse

// mouse handler
func (but *Button) Mouse(x int, y int, deltaX int, deltaY int, flags uint16) {

	if but.style&BS_TOGGLE != 0 {
		if (flags & mouse.F_L_CLICK) != 0 {
			but.pushed = !but.pushed
			but.Draw()
			but.clickHndr(but.pushed)
		}
	} else {
		if (flags & mouse.F_L_CLICK) != 0 {
			log.Debug("Button ms handler: click")
			but.pushed = true
			but.wasClicked = true
			but.Draw()
		} else if but.wasClicked && (flags&mouse.F_L_RELEASE) != 0 {
			log.Debug("Button ms handler: release")
			but.pushed = false
			but.wasClicked = false
			but.Draw()
			but.clickHndr(false)
		} else if but.wasClicked && (flags&mouse.F_EL_LEAVE) != 0 {
			// release the button if user clicked inside it and then dragged the mouse outside without releasing the mouse button
			log.Debug("Button ms handler: clicked inside. released outside.")
			but.pushed = false
			but.wasClicked = false
			but.Draw()
		}
	}
}
開發者ID:romovs,項目名稱:viscum,代碼行數:30,代碼來源:button.go

示例5: closeInMass

//Close all the objects at once and wait forr them to finish with a channel.
func (d *Death) closeInMass(closable ...Closable) {
	count := len(closable)
	//call close async
	done := make(chan bool, count)
	for _, c := range closable {
		go d.closeObjects(c, done)
	}

	//wait on channel for notifications.

	timer := time.NewTimer(d.timeout)
	for {
		select {
		case <-timer.C:
			log.Warn(count, " object(s) remaining but timer expired.")
			return
		case <-done:
			count--
			log.Debug(count, " object(s) left")
			if count == 0 {
				log.Debug("Finished closing objects")
				return
			}
		}
	}
}
開發者ID:Fresheyeball,項目名稱:death,代碼行數:27,代碼來源:death.go

示例6: handlerLoop

func (r *Consumer) handlerLoop(handler Handler) {
	clog.Debug("starting Handler")

	for {
		message, ok := <-r.incomingMessages
		if !ok {
			goto exit
		}

		if r.shouldFailMessage(message, handler) {
			message.Finish()
			continue
		}

		err := handler.HandleMessage(message)
		if err != nil {
			clog.Errorf("Handler returned error (%s) for msg %s", err, message.ID)
			if !message.IsAutoResponseDisabled() {
				message.Requeue(-1)
			}
			continue
		}

		if !message.IsAutoResponseDisabled() {
			message.Finish()
		}
	}

exit:
	clog.Debug("stopping Handler")
	if atomic.AddInt32(&r.runningHandlers, -1) == 0 {
		r.exit()
	}
}
開發者ID:huangping40,項目名稱:go-nsq_hailocab,代碼行數:34,代碼來源:consumer.go

示例7: Run

func (a *run_tagger_action) Run() {
	SetupLogging(*a.verbosity)

	a.loadTokens()
	log.Debug("Tokens loaded")

	log.Debug("Filling connection pool")
	a.setupConnPool()

	taggers := new(tagger.Taggers)
	taggers.Init(a.connPool, a.workers)
	go taggers.Spawn()

	log.Debug("Tagging")
	// For each token, find it in the db
	for i := range a.tokens {
		taggers.Queue <- &a.tokens[i]
	}

	close(taggers.Queue)
	<-taggers.Done

	// Write the missing tokens to disk
	fw := new(filewriter.TrecFileWriter)
	fw.Init("/tmp/missing_tokens")
	go fw.WriteAllTokens()
	for i := range taggers.MissingTokens {
		fw.StringChan <- &taggers.MissingTokens[i]
	}
	close(fw.StringChan)
	fw.Wait()

	// If not found...
}
開發者ID:Georgetown-IR-Lab,項目名稱:ocr-correction,代碼行數:34,代碼來源:tagger.go

示例8: Connect

func (r *RabbitConnection) Connect(connected chan bool) {
	for {
		log.Debug("[Rabbit] Attempting to connect…")
		if err := r.tryToConnect(); err != nil {
			sleepFor := time.Second
			log.Debugf("[Rabbit] Failed to connect, sleeping %s…", sleepFor.String())
			time.Sleep(sleepFor)
			continue
		}
		connected <- true
		r.connected = true
		notifyClose := make(chan *amqp.Error)
		r.Connection.NotifyClose(notifyClose)

		// Block until we get disconnected, or shut down
		select {
		case err := <-notifyClose:
			r.connected = false
			log.Debugf("[Rabbit] AMQP connection closed (notifyClose): %s", err.Error())
			return

		case <-r.closeChan:
			// Shut down connection
			log.Debug("[Rabbit] Closing AMQP connection (closeChan closed)…")
			if err := r.Connection.Close(); err != nil {
				log.Errorf("Failed to close AMQP connection: %v", err)
			}
			r.connected = false
			return
		}
	}
}
開發者ID:boyand,項目名稱:typhon,代碼行數:32,代碼來源:rabbit.go

示例9: connPing

func connPing() {
	timer := time.NewTicker(2 * time.Second)
	log.Debug("ping tcp ......")
	for {
		select {
		case <-timer.C:
			_, err := connection.Write([]byte(""))
			if err != nil {
				if netType == "tcp" {
					conn, err := utils.ConnTCP(address)
					log.Debug("can connection tcp ", err)
					if err == nil {
						connection = conn
					}
				} else if netType == "tls" {
					conn, err := utils.ConnTLS(address)
					log.Debug("can connection tls ", err)
					if err == nil {
						connection = conn
					}
				}
			}
		}
	}
}
開發者ID:Dataman-Cloud,項目名稱:logspout,代碼行數:25,代碼來源:raw.go

示例10: UpdateIndexSettings

func (s *ESAPIV0) UpdateIndexSettings(name string, settings map[string]interface{}) error {

	log.Debug("update index: ", name, settings)
	cleanSettings(settings)
	url := fmt.Sprintf("%s/%s/_settings", s.Host, name)

	if _, ok := settings["settings"].(map[string]interface{})["index"]; ok {
		if set, ok := settings["settings"].(map[string]interface{})["index"].(map[string]interface{})["analysis"]; ok {
			log.Debug("update static index settings: ", name)
			staticIndexSettings := getEmptyIndexSettings()
			staticIndexSettings["settings"].(map[string]interface{})["index"].(map[string]interface{})["analysis"] = set
			Post(fmt.Sprintf("%s/%s/_close", s.Host, name), s.Auth, "", s.HttpProxy)
			body := bytes.Buffer{}
			enc := json.NewEncoder(&body)
			enc.Encode(staticIndexSettings)
			bodyStr, err := Request("PUT", url, s.Auth, &body, s.HttpProxy)
			if err != nil {
				log.Error(bodyStr, err)
				panic(err)
				return err
			}
			delete(settings["settings"].(map[string]interface{})["index"].(map[string]interface{}), "analysis")
			Post(fmt.Sprintf("%s/%s/_open", s.Host, name), s.Auth, "", s.HttpProxy)
		}
	}

	log.Debug("update dynamic index settings: ", name)

	body := bytes.Buffer{}
	enc := json.NewEncoder(&body)
	enc.Encode(settings)
	_, err := Request("PUT", url, s.Auth, &body, s.HttpProxy)

	return err
}
開發者ID:medcl,項目名稱:elasticsearch-migration,代碼行數:35,代碼來源:v0.go

示例11: NewFileReadWorker

func (m *Migrator) NewFileReadWorker(pb *pb.ProgressBar, wg *sync.WaitGroup) {
	log.Debug("start reading file")
	f, err := os.Open(m.Config.DumpInputFile)
	if err != nil {
		log.Error(err)
		return
	}

	defer f.Close()
	r := bufio.NewReader(f)
	lineCount := 0
	for {
		line, err := r.ReadString('\n')
		if io.EOF == err || nil != err {
			break
		}
		lineCount += 1
		js := map[string]interface{}{}

		//log.Trace("reading file,",lineCount,",", line)
		err = json.Unmarshal([]byte(line), &js)
		if err != nil {
			log.Error(err)
			continue
		}
		m.DocChan <- js
		pb.Increment()
	}

	defer f.Close()
	log.Debug("end reading file")
	close(m.DocChan)
	wg.Done()
}
開發者ID:medcl,項目名稱:elasticsearch-migration,代碼行數:34,代碼來源:file.go

示例12: Play

func (s *RtmpNetStream) Play(streamName string, args ...Args) error {
	conn := s.conn
	s.mode = MODE_PRODUCER
	sendCreateStream(conn)
	for {
		msg, err := readMessage(conn)
		if err != nil {
			return err
		}

		if m, ok := msg.(*UnknowCommandMessage); ok {
			log.Debug(m)
			continue
		}
		reply := new(ReplyCreateStreamMessage)
		reply.Decode0(msg.Header(), msg.Body())
		log.Debug(reply)
		conn.streamid = reply.StreamId
		break
	}
	sendPlay(conn, streamName, 0, 0, false)
	for {
		msg, err := readMessage(conn)
		if err != nil {
			return err
		}
		if m, ok := msg.(*UnknowCommandMessage); ok {
			log.Debug(m)
			continue
		}
		result := new(ReplyPlayMessage)
		result.Decode0(msg.Header(), msg.Body())
		log.Debug(result)
		code := getString(result.Object, "code")
		if code == NetStream_Play_Reset {
			continue
		} else if code == NetStream_Play_Start {
			break
		} else {
			return errors.New(code)
		}
	}
	sendSetBufferMessage(conn)
	if strings.HasSuffix(conn.app, "/") {
		s.path = conn.app + strings.Split(streamName, "?")[0]
	} else {
		s.path = conn.app + "/" + strings.Split(streamName, "?")[0]
	}

	err := notifyPlaying(s)
	if err != nil {
		return err
	}
	go s.cserve()
	return nil
}
開發者ID:sichuanyl,項目名稱:babylon,代碼行數:56,代碼來源:rtmp_netstream.go

示例13: listenOnUdpConnection

func (manager *ConnectionManager) listenOnUdpConnection() {
	var buffer [2048]byte

	// Listen forever
	// TODO: Revisit
	for {
		length, remoteAddr, err := manager.udpConn.ReadFromUDP(buffer[0:])
		if err != nil {
			panic(err.Error())
		}

		// Check if we've seen UDP packets from this address before - if so, reuse
		// existing client object
		client, ok := manager.udpClients[remoteAddr.String()]
		if !ok {
			log.Debug("New UDP client")
			writer := udp.NewUDPWriter(manager.udpConn, remoteAddr)
			bufferedWriter := bufio.NewWriter(writer)

			client = NewClient(strconv.Itoa(manager.rand.Int()), bufferedWriter, nil)
			manager.udpClients[remoteAddr.String()] = client
		} else {
			log.Debug("Found UDP client!")
		}

		// Log the number of bytes received
		manager.qm.metricsManager.metricsChannel <- NewMetric("bytesin.udp", "counter", int64(length))

		// TODO: Parse message, and check if we're expecting a message
		commandTokens := strings.Fields(string(buffer[:length]))
		var message []byte
		if commandTokens[0] == "pub" {
			// Use bytes.Equal until Go1.7 (https://github.com/golang/go/issues/14302)
			for {
				var err error
				length, _, err := manager.udpConn.ReadFromUDP(buffer[0:])

				if err != nil {
					return
				}

				// TODO: Is this cross platform? Needs testing
				if !bytes.Equal(buffer[:length], []byte{'.', '\r', '\n'}) {
					message = append(message, buffer[:length]...)
				} else {
					break
				}
			}
		}

		manager.parseClientCommand(commandTokens, &message, client)

		log.Debugf("Read %d bytes from %s: %s", length, remoteAddr, string(buffer[:length]))
	}
}
開發者ID:FireEater64,項目名稱:gamq,代碼行數:55,代碼來源:connectionmanager.go

示例14: Init

// Initialize frame buffer device
func Init(fbdev, tty string) (*Framebuffer, error) {

	var fb = new(Framebuffer)
	var err error

	fb.tty, err = os.OpenFile(tty, os.O_RDWR, os.ModeDevice)
	if err != nil {
		return nil, err
	}

	// switch to graphics mode
	// this prevents kernel modifying the video ram (vt switching/blanking, cursor, gpm mouse cursor)
	err = ioctl(fb.tty.Fd(), KDSETMODE, unsafe.Pointer(uintptr(KD_GRAPHICS)))
	if err != nil {
		fb.tty.Close()
		return nil, err
	}

	fb.dev, err = os.OpenFile(fbdev, os.O_RDWR, os.ModeDevice)
	if err != nil {
		fb.tty.Close()
		return nil, err
	}

	err = ioctl(fb.dev.Fd(), FBIOGET_FSCREENINFO, unsafe.Pointer(&fb.finfo))
	if err != nil {
		fb.dev.Close()
		fb.tty.Close()
		return nil, err
	}
	log.Debug(utils.StructPrint(&fb.finfo))

	err = ioctl(fb.dev.Fd(), FBIOGET_VSCREENINFO, unsafe.Pointer(&fb.Vinfo))
	if err != nil {
		fb.dev.Close()
		fb.tty.Close()
		return nil, err
	}
	log.Debug(utils.StructPrint(&fb.Vinfo))

	memSize := int(fb.finfo.Smem_len + uint32(fb.finfo.Smem_start&uint64(syscall.Getpagesize()-1)))

	fb.Mem, err = syscall.Mmap(int(fb.dev.Fd()), 0, memSize, PROT_READ|PROT_WRITE, MAP_SHARED)
	if err != nil {
		fb.dev.Close()
		fb.tty.Close()
		return nil, err
	}

	fb.MemOffscreen = make([]byte, memSize)

	return fb, nil
}
開發者ID:romovs,項目名稱:viscum,代碼行數:54,代碼來源:fbdev.go

示例15: DeleteIndex

func (s *ESAPIV0) DeleteIndex(name string) (err error) {

	log.Debug("start delete index: ", name)

	url := fmt.Sprintf("%s/%s", s.Host, name)

	Request("DELETE", url, s.Auth, nil, s.HttpProxy)

	log.Debug("delete index: ", name)

	return nil
}
開發者ID:medcl,項目名稱:elasticsearch-migration,代碼行數:12,代碼來源:v0.go


注:本文中的github.com/cihub/seelog.Debug函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。