本文整理匯總了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
}
示例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
}
示例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()
}
示例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
}