本文整理汇总了Golang中github.com/cihub/seelog.Debug函数的典型用法代码示例。如果您正苦于以下问题:Golang Debug函数的具体用法?Golang Debug怎么用?Golang Debug使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Debug函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: removeLeastRecentlyUsedImage
func (imageManager *dockerImageManager) removeLeastRecentlyUsedImage() error {
seelog.Debug("Attempting to obtain ImagePullDeleteLock for removing images")
ImagePullDeleteLock.Lock()
seelog.Debug("Obtained ImagePullDeleteLock for removing images")
defer seelog.Debug("Released ImagePullDeleteLock after removing images")
defer ImagePullDeleteLock.Unlock()
leastRecentlyUsedImage := imageManager.getUnusedImageForDeletion()
if leastRecentlyUsedImage == nil {
return fmt.Errorf("No more eligible images for deletion")
}
imageManager.removeImage(leastRecentlyUsedImage)
return nil
}
开发者ID:umaptechnologies,项目名称:amazon-ecs-agent,代码行数:13,代码来源:docker_image_manager.go
示例17: CreateApp
func CreateApp(app *model.App) (*model.App, error) {
log.Debug(s.GetLeader())
if _, err := s.CreateApp(app); err != nil {
return nil, err
}
if app.Instance == 0 {
log.Debug("====:", app.Instance)
return app, nil
}
for i := uint64(0); i < app.Instance; i++ {
go CreateAndStartContainer(app)
}
return app, nil
}
开发者ID:yiqguo,项目名称:beehive,代码行数:14,代码来源:store.go
示例18: Mouse
// mouse handler
func (but *TitleBarButton) Mouse(x int, y int, deltaX int, deltaY int, flags uint16) {
if (flags & mouse.F_L_CLICK) != 0 {
log.Debug("TitleBarButton ms handler: click")
but.wasClicked = true
gfx.RectFilled(but.parent.Element.Buffer, but.Element.X, but.Element.Y, but.Element.X+but.Element.Width, but.Element.Y+but.Element.Height, but.parent.Element.Width, 49, 80, 0, gfx.A_OPAQUE)
gfx.Rect(but.parent.Element.Buffer, but.Element.X, but.Element.Y, but.Element.X+but.Element.Width-1, but.Element.Y+but.Element.Height-1, but.parent.Element.Width, 0, 0, 0, gfx.A_OPAQUE)
} else if but.wasClicked && (flags&mouse.F_L_RELEASE) != 0 {
log.Debug("TitleBarButton ms handler: release")
but.wasClicked = false
but.Draw()
but.clickHndr(false)
}
}
开发者ID:romovs,项目名称:viscum,代码行数:15,代码来源:titlebarbutton.go
示例19: complex_handshake
func complex_handshake(rw *bufio.ReadWriter, input []byte) bool {
result, scheme, challenge, digest := validateClient(input)
if !result {
return result
}
log.Debugf("Validate Client %v scheme %v challenge %0X digest %0X", result, scheme, challenge, digest)
s1 := create_s1()
log.Debug("s1 length", len(s1))
off := getDigestOffset(s1, scheme)
log.Debug("s1 digest offset", off)
buf := new(bytes.Buffer)
buf.Write(s1[:off])
buf.Write(s1[off+32:])
tempHash, _ := HMACsha256(buf.Bytes(), GENUINE_FMS_KEY[:36])
copy(s1[off:], tempHash)
log.Debug("s1 length", len(s1))
//compute the challenge digest
tempHash, _ = HMACsha256(digest, GENUINE_FMS_KEY[:68])
log.Debug("s2 length tempHash", len(tempHash))
randBytes := create_s2()
log.Debug("s2 length", len(randBytes))
lastHash, _ := HMACsha256(randBytes, tempHash)
log.Debug("s2 length lastHash", len(lastHash))
log.Debug("s2 length", len(randBytes))
buf = new(bytes.Buffer)
buf.WriteByte(0x03)
buf.Write(s1)
buf.Write(randBytes)
buf.Write(lastHash)
log.Debug("send s0s1s2", buf.Len())
rw.Write(buf.Bytes())
rw.Flush()
ReadBuf(rw, HANDSHAKE_SIZE)
return true
}
开发者ID:sichuanyl,项目名称:babylon,代码行数:35,代码来源:rtmp_handshake.go
示例20: serve
func serve(srv *Server, con net.Conn) {
conn := newconn(con, srv)
if !handshake1(conn.buf) {
conn.Close()
return
}
log.Debug("readMessage")
msg, err := readMessage(conn)
if err != nil {
log.Error("NetConnecton read error", err)
conn.Close()
return
}
cmd, ok := msg.(*ConnectMessage)
if !ok || cmd.Command != "connect" {
log.Error("NetConnecton Received Invalid ConnectMessage ", msg)
conn.Close()
return
}
conn.app = getString(cmd.Object, "app")
conn.objectEncoding = int(getNumber(cmd.Object, "objectEncoding"))
log.Debug(cmd)
err = sendAckWinsize(conn, 512<<10)
if err != nil {
log.Error("NetConnecton sendAckWinsize error", err)
conn.Close()
return
}
err = sendPeerBandwidth(conn, 512<<10)
if err != nil {
log.Error("NetConnecton sendPeerBandwidth error", err)
conn.Close()
return
}
err = sendStreamBegin(conn)
if err != nil {
log.Error("NetConnecton sendStreamBegin error", err)
conn.Close()
return
}
err = sendConnectSuccess(conn)
if err != nil {
log.Error("NetConnecton sendConnectSuccess error", err)
conn.Close()
return
}
conn.connected = true
newNetStream(conn, shandler, nil).serve()
}
开发者ID:sichuanyl,项目名称:babylon,代码行数:49,代码来源:server.go
注:本文中的github.com/cihub/seelog.Debug函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论