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


Golang logger.Logger類代碼示例

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


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

示例1: BuildHandlerFromConf

// Receives a configuration struct and creates the relevant Handler
func BuildHandlerFromConf(conf config.Handler, log logger.Logger) *Handler {

	var l Handler
	switch conf.GetType() {
	case "sqs":
		tl := &Sqs{Config: &appHandConfig.Sqs{}}
		tl.Log = log
		tl.Config.Init(conf.String())
		l = tl

	case "lambda":
		tl := &Lambda{Config: &appHandConfig.Lambda{}}
		tl.Log = log
		tl.Config.Init(conf.String())
		l = tl

	case "oauth2":
		tl := &OAuth2{Config: &appHandConfig.OAuth2{}}
		tl.Log = log
		tl.Config.Init(conf.String())
		l = tl

	case "cli":
		tl := &Cli{Config: &appHandConfig.Cli{}}
		tl.Log = log
		tl.Config.Init(conf.String())
		l = tl

	default:
		log.Warning("Could not create handler for type '%s'", conf.GetType())
		return nil

	}
	return &l
}
開發者ID:hyprstack,項目名稱:eevy,代碼行數:36,代碼來源:handler.go

示例2: BuildFromConf

func BuildFromConf(conf appConfig.HandlerList, log logger.Logger) *HandlerList {
	hl := &HandlerList{
		List: make(map[string]Handler),
	}
	for name, c := range conf {
		h := *BuildHandlerFromConf(&c, log)
		h.SetName(name)

		log.Debug("Created handler, %s, of type %s", h.GetName(), h.GetType())
		hl.List[name] = h
	}
	return hl
}
開發者ID:hyprstack,項目名稱:eevy,代碼行數:13,代碼來源:handler.go

示例3: StartSources

// Pass in the source configuration and this function both builds and starts listening to the source
func StartSources(sourceConf *[]config.Source, rootList *listener.Listener, log logger.Logger, wg sync.WaitGroup) {

	log.Info("%d listeners to start", len(*sourceConf))
	var wgLocal sync.WaitGroup
	var sources []Source
	for _, conf := range *sourceConf {
		tmp := BuildFromConfig(conf, rootList, log)

		sources = append(sources, tmp)
		wgLocal.Add(1)
		go tmp.Listen(wgLocal)
	}
	wgLocal.Wait()
	wg.Done()
}
開發者ID:hyprstack,項目名稱:eevy,代碼行數:16,代碼來源:source.go

示例4: BuildListener

func BuildListener(conf config.ListenerList, hl *handler.HandlerList, log logger.Logger) *Listener {
	rootListener := Listener{}
	rootListener.Log = log

	rootListener.Name = ""
	for evtName, listners := range conf {

		log.Debug("Creating listeners for \"%s\": %q", evtName, listners)
		for _, l := range listners {

			h := hl.Get(l)
			if h == nil {
				log.Warning("Could not find handler with name '%s'", l)
				continue
			}
			rootListener.Add(evtName, h)
		}
	}
	return &rootListener
}
開發者ID:hyprstack,項目名稱:eevy,代碼行數:20,代碼來源:listener.go


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