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


Golang seelog.Info函數代碼示例

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


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

示例1: Run

//Run the app.
func Run() (err error) {
	var wg sync.WaitGroup
	log.Info("Starting gomasticate")
	conf, err := NewConf("conf.yaml")
	if nil != err {
		log.Error(err)
		return
	}
	log.Info(conf)
	chewChan := make(chan *messaging.Food, 2000)
	swallowChan := make(chan *messaging.Food, 4000)

	done := make(chan interface{})

	wg.Add(2)
	go lips.OpenWide(chewChan, done, &wg, conf.LipsPort())
	go chew.Chew(chewChan, swallowChan, &wg)

	sw := swallow.NewSwallow(conf.EsHost(), swallowChan, 10)

	//handle signals
	c := make(chan os.Signal, 1)
	s := make(chan int, 1)
	signal.Notify(c)
	go Death(c, s)
	death := <-s //time for shutdown
	log.Debug("Death return code: ", death)
	close(done)
	sw.Close()
	log.Info("Waiting for goroutines to finish...")
	wg.Wait()
	log.Info("Exiting")
	return
}
開發者ID:vrecan,項目名稱:gomasticate,代碼行數:35,代碼來源:start.go

示例2: CheckIn

func CheckIn(path string) {
	log.Info("Starting db checking background script: " + path)
	ticker := time.NewTicker(10 * time.Second)
	quit := make(chan struct{})
	go func() {
		for {
			select {
			case <-ticker.C:
				nodeinfo.UpdateConnection()
				log.Info("Checking all changed stuff in db for: " + path)
				listener := utils.GetListenerFromDir(path)
				items, err := datastore.CheckIn(listener)
				if err != nil {
					log.Infof("Error occurred getting data for %s (%s): %+v", listener, err.Error(), err)
				}
				cfg := utils.GetConfig()
				handleDataChanges(items, cfg.Listeners[listener], listener)
			// @TODO: check that db knows Im alive.
			case <-quit:
				ticker.Stop()
				return
			}
		}
	}()
}
開發者ID:huuzkee-foundation,項目名稱:gosync,代碼行數:25,代碼來源:main.go

示例3: loadNotifiers

func loadNotifiers(app *ApplicationContext) error {
	// Set up the Emailer, if configured
	if len(app.Config.Email) > 0 {
		log.Info("Configuring Email notifier")
		emailer, err := NewEmailer(app)
		if err != nil {
			log.Criticalf("Cannot configure email notifier: %v", err)
			return err
		}
		app.Emailer = emailer
	}

	// Set up the HTTP Notifier, if configured
	if app.Config.Httpnotifier.Url != "" {
		log.Info("Configuring HTTP notifier")
		httpnotifier, err := NewHttpNotifier(app)
		if err != nil {
			log.Criticalf("Cannot configure HTTP notifier: %v", err)
			return err
		}
		app.HttpNotifier = httpnotifier
	}

	return nil
}
開發者ID:sslavic,項目名稱:Burrow,代碼行數:25,代碼來源:main.go

示例4: Shutdown

func (m *Management) Shutdown() {
	log.Info("Management: shutdown")
	close(m.shutdown)

	m.waitGroup.Wait()
	log.Info("Management: shutdown done")
}
開發者ID:nab911,項目名稱:go-openvpn,代碼行數:7,代碼來源:management.go

示例5: main

func main() {
	f, err := os.Open("ok.txt")
	if err != nil {
		log.Info(err)
		return
	}
	defer f.Close()
	stat, err := f.Stat()
	if err != nil {
		log.Error("stat err")
	}
	data := make([]byte, stat.Size())
	_, err = f.Read(data)
	if err != nil {
		log.Error("read err")
	}
	dataStr := string(data)

	log.Info(dataStr)

	dirInfo()

	demoList()

}
開發者ID:dongwq,項目名稱:go-demo,代碼行數:25,代碼來源:fileIO.go

示例6: PusherProto

//Simple pusher for testing
func PusherProto(count int, finished chan int, msg *messaging.Food, port int) {
	log.Info("Starting pusher")
	socket, err := nano.NewPushSocket()
	if nil != err {
		log.Error(err)
	}
	defer socket.Close()
	socket.SetSendTimeout(500 * time.Millisecond)
	sport := strconv.Itoa(port)
	_, err = socket.Connect("tcp://localhost:" + sport)
	if nil != err {
		log.Error(err)
		return
	}
	log.Info("Connected and ready to send data")
	tot := 0
	for {
		bytes, _ := msg.Marshal()
		_, err := socket.Send(bytes, 0) //blocking
		if nil != err {
			log.Error(err)
			continue
		} else {
			tot++
		}
		if tot >= count {
			break
		}
	}
	log.Info("Finished sending data exiting")
	finished <- tot
}
開發者ID:vrecan,項目名稱:gomasticate,代碼行數:33,代碼來源:pusher.go

示例7: InitialSync

func InitialSync() {
	cfg := utils.GetConfig()
	log.Info("Verifying DB Tables")
	datastore.CreateDB()
	log.Info("Initial sync starting...")

	for key, listener := range cfg.Listeners {

		// First check to see if the table is empty and do a full import false == not empty
		if datastore.CheckEmpty(key) == false {
			// Database is not empty so pull the updates and match locally
			items := datastore.FetchAll(key)
			handleDataChanges(items, listener, key)
		} else {
			// Database is empty so lets import
			fsItems := utils.ListFilesInDir(listener.Directory)
			for _, item := range fsItems {
				success := datastore.Insert(key, item)
				if success != true {
					log.Infof("An error occurred inserting %x to database", item)
				}
				if !item.IsDir {
					storage.PutFile(item.Filename, key)
				}

			}
		}

	}

	log.Info("Initial sync completed...")
}
開發者ID:huuzkee-foundation,項目名稱:gosync,代碼行數:32,代碼來源:main.go

示例8: heartBeat

func (ss *Session) heartBeat() chan bool {
	done := make(chan bool)
	ss.heartTicker = done
	go func() {
		t := time.Duration(ss.server.Config.HeartbeatInterval) * time.Second
		ticker := time.NewTicker(t)
		loop := true
		for loop {
			select {
			case <-ticker.C:
				err := ss.defaultNS.sendPacket(new(heartbeatPacket))
				if err != nil {

				}
				log.Info("sent heart beat missed = ", ss.missedHeartbeats)
				ss.missedHeartbeats += 1
				// TODO: Configurable
				if ss.missedHeartbeats > 2 {
					log.Info("heartBeat missedHeartbeats ", ss.SessionId)
					ss.Close("")
					loop = false
				}
			case <-done:
				log.Infof("[%s] stop heartBeat", ss.SessionId)
				ticker.Stop()
				//ss.heartTicker = nil
				return
			}
		}
	}()
	return done
}
開發者ID:xjtdy888,項目名稱:go-socket.io,代碼行數:32,代碼來源:session.go

示例9: RawMessage

func (ss *Session) RawMessage(msg []byte) error {
	log.Trace("RawMessage ", string(msg))
	packet, err := decodePacket(msg)
	if err != nil {
		log.Info("decodePacket error ", err, string(msg))
		return nil
	}
	if packet == nil {
		log.Info("packet == nil ")
		return nil

	}

	if packet.EndPoint() == "" {
		if err := ss.onPacket(packet); err != nil {
			log.Error(err)
			return nil
		}
	}

	ns := ss.Of(packet.EndPoint())
	if ns == nil {
		return nil
	}
	ns.onPacket(packet)
	return nil
}
開發者ID:xjtdy888,項目名稱:go-socket.io,代碼行數:27,代碼來源:session.go

示例10: calcDailySummary

func calcDailySummary(now time.Time, config StartupConfig, runningConfig RunningConfig) {
	log.Infof("lastSummaryTime is %v", runningConfig.LastSummaryTime)
	if runningConfig.LastSummaryTime.Day() != now.Day() {
		startTime := now.Truncate(24 * time.Hour).Add(-24 * time.Hour)
		endTime := startTime.Add(24 * time.Hour)
		log.Info("Summarizing from ", startTime, " (", startTime.Unix(), ") to ", endTime, " (", endTime.Unix(), ")")

		// influx connection
		influxClient, err := influxConnect(config, runningConfig)
		if err != nil {
			log.Error("Could not connect to InfluxDb to get daily summary stats!!")
			errHndlr(err, ERROR)
			return
		}

		bp, _ := influx.NewBatchPoints(influx.BatchPointsConfig{
			Database:        "daily_stats",
			Precision:       "s",
			RetentionPolicy: config.DailySummaryRetentionPolicy,
		})

		calcDailyMaxGbps(influxClient, bp, startTime, endTime, config)
		calcDailyBytesServed(influxClient, bp, startTime, endTime, config)
		log.Info("Collected daily stats @ ", now)
	}
}
開發者ID:bengunter,項目名稱:traffic_control,代碼行數:26,代碼來源:traffic_stats.go

示例11: WatchNodeInfoMap

/**
 * watch the node list change.
 */
func (self *NodeInfoMaps) WatchNodeInfoMap() {
	_, _, ch, err := self.zk.GetZkConn().ChildrenW("/yundis/nodes")
	if err != nil {
		log.Errorf("Can not watch path /yundis/nodes, err:%s", err)
	}
	go func() {
		for {
			event := <-ch
			log.Infof("node list change, %+v", event)
			children, _, ch1, err1 := self.zk.GetZkConn().ChildrenW("/yundis/nodes")
			if err1 == nil {
				ch = ch1
				//handle the node list change event
				log.Infof("node list changed : %s", children)
				infoMap := self.getNodeInfoMapFromZk()
				//change the slotinfo state.
				log.Info("The node list changed, begin to change the affected slot's info.")
				self.SetNodeInfoMap(infoMap) //refresh nodeinfo map by new zk data.
				self.ModifySlotState(infoMap)
				log.Info("Refresh nodeinfo map by new zk data.")
			} else {
				log.Errorf("Can not watching the children of /yundis/nodes, err:%s", err1)
				break
			}
			time.Sleep(time.Second)
		}
	}()
}
開發者ID:yuwnloyblog,項目名稱:yundis,代碼行數:31,代碼來源:nodeinfomaps.go

示例12: Chew

func Chew(chewChan <-chan *messaging.Food, swallowChan chan *messaging.Food, wg *sync.WaitGroup) {
	log.Info("Let the chewing begin!")
	defer close(swallowChan)
	r := rep.NewReporter()
	r.RegisterStatWIndex("chew", "good")
	for msg := range chewChan {
		if nil != msg {
			//parsing work here probably change what our message type looks like when swallowed

			date := time.Unix(0, msg.GetTimeNano()).UTC()
			fmtDate := date.Format("2006-01-02")
			indexType := "all"
			customerId := "id" //should exist eventually
			index := "documents-" + customerId + "-" + fmtDate
			msg.Index = &index
			msg.IndexType = &indexType
			r.AddStatWIndex("chew", 1, "good")
			swallowChan <- msg
		}
	}
	log.Info("Done chewing")
	log.Flush()
	wg.Done()

}
開發者ID:vrecan,項目名稱:gomasticate,代碼行數:25,代碼來源:chew.go

示例13: RunReceiverRPC

func RunReceiverRPC() {
	log.Info("Starting Receiver RPC\n")
	ln, err := net.ListenUnix("unix", appAddr)
	if err != nil {
		log.Errorf("Failed to start RPC server: %v", err)
		return
	}

	Receiver = receiverrpc.Receiver{}
	rpc.Register(&Receiver)
	log.Infof("RPC server is listening on %s\n", appAddr.String())

	defer func() {
		// close the listener sock
		log.Info("Closing listener socket.\n")
		ln.Close()
	}()

	for {
		ln.SetDeadline(time.Now().Add(time.Second))
		conn, err := ln.AcceptUnix()
		if err != nil {
			if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
				// just accept timeout, not an error
				continue
			}
			log.Error("Failed to accept: %s", err.Error())
			continue
		}
		rpc.ServeConn(conn)
	}
}
開發者ID:zhengzhiren,項目名稱:pushserver,代碼行數:32,代碼來源:app_main.go

示例14: SendVideo

func (s *RtmpNetStream) SendVideo(video *StreamPacket) error {
	log.Debug(video)
	if s.vkfsended {
		video.Timestamp -= s.vsend_time - uint32(s.bufferTime)
		s.vsend_time += video.Timestamp
		return sendVideo(s.conn, video)
	}
	if !video.isKeyFrame() {
		//log.Info("No Video Key Frame,Ignore Video ", video)
		//video = s.dispatcher.producer.lastVideoKeyFrame
		return nil
	}
	fkf := s.dispatcher.producer.firstVideoKeyFrame
	if fkf == nil {
		log.Info("No Video Configurate Record,Ignore Video ", video)
		return nil
	}
	fkf.Timestamp = 0
	log.Info("Send Video Configurate Record ", fkf)
	//log.Infof(" Payload %02X", fkf.Payload)
	ver := fkf.Payload[4+1]
	avcPfofile := fkf.Payload[4+2]
	profileCompatibility := fkf.Payload[4+3]
	avcLevel := fkf.Payload[4+4]
	reserved := fkf.Payload[4+5] >> 2
	lengthSizeMinusOne := fkf.Payload[4+5] & 0x03
	reserved2 := fkf.Payload[4+6] >> 5
	numOfSPS := fkf.Payload[4+6] & 31
	spsLength := util.BigEndian.Uint16(fkf.Payload[4+7:])
	sps := fkf.Payload[4+9 : 4+9+int(spsLength)]
	numOfPPS := fkf.Payload[4+9+int(spsLength)]
	ppsLength := util.BigEndian.Uint16(fkf.Payload[4+9+int(spsLength)+1:])
	pps := fkf.Payload[4+9+int(spsLength)+1+2:]
	log.Infof("  cfgVersion(%v) | avcProfile(%v) | profileCompatibility(%v) |avcLevel(%v) | reserved(%v) | lengthSizeMinusOne(%v) | reserved(%v) | numOfSPS(%v) |spsLength(%v) | sps(%02X) | numOfPPS(%v) | ppsLength(%v) | pps(%02X) ",
		ver,
		avcPfofile,
		profileCompatibility,
		avcLevel,
		reserved,
		lengthSizeMinusOne,
		reserved2,
		numOfSPS,
		spsLength,
		sps,
		numOfPPS,
		ppsLength,
		pps)
	err := sendFullVideo(s.conn, fkf)
	if err != nil {
		return err
	}
	s.vkfsended = true
	s.vsend_time = video.Timestamp
	video.Timestamp = 0
	log.Info("Send I Frame ", video)
	log.Infof(" Payload %v/%v", video.Payload[9]&0x1f, video.Payload[10])

	return sendFullVideo(s.conn, video)
}
開發者ID:sichuanyl,項目名稱:babylon,代碼行數:59,代碼來源:rtmp_netstream.go

示例15: main

func main() {
	log.Info("Initialize!")

	var proxy = service.Proxy{}
	var refresh = service.Refresh{}

	log.Info("Run!")

	refresh.Run(&proxy)
}
開發者ID:fishedee,項目名稱:MyUtil,代碼行數:10,代碼來源:main.go


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