本文整理匯總了Golang中github.com/koding/logging.Logger.Critical方法的典型用法代碼示例。如果您正苦於以下問題:Golang Logger.Critical方法的具體用法?Golang Logger.Critical怎麽用?Golang Logger.Critical使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/koding/logging.Logger
的用法示例。
在下文中一共展示了Logger.Critical方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: MustInitBongo
func MustInitBongo(
appName string,
eventExchangeName string,
c *Config,
log logging.Logger,
metrics *metrics.Metrics,
debug bool,
) *bongo.Bongo {
rmqConf := &rabbitmq.Config{
Host: c.Mq.Host,
Port: c.Mq.Port,
Username: c.Mq.Login,
Password: c.Mq.Password,
Vhost: c.Mq.Vhost,
}
bConf := &broker.Config{
RMQConfig: rmqConf,
ExchangeName: eventExchangeName,
QOS: 10,
}
db := MustInitDB(c, log, debug)
broker := broker.New(appName, bConf, log)
// set metrics for broker
broker.Metrics = metrics
bongo := bongo.New(broker, db, log)
err := bongo.Connect()
if err != nil {
log.Fatal("Error while starting bongo, exiting err: %s", err.Error())
}
log.Info("Caching disabled: %v", c.DisableCaching)
if !c.DisableCaching {
redisConn, err := InitRedisConn(c)
if err != nil {
log.Critical("Bongo couldnt connect to redis, caching will not be available Err: %s", err.Error())
} else {
bongo.Cache = redisConn
}
}
return bongo
}
示例2: registerSignalHandler
func registerSignalHandler(l *asgd.LifeCycle, log logging.Logger) chan struct{} {
done := make(chan struct{}, 1)
go func() {
signals := make(chan os.Signal, 1)
signal.Notify(signals)
signal := <-signals
switch signal {
case syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGSTOP, syscall.SIGKILL:
log.Info("recieved exit signal, closing...")
err := l.Close()
if err != nil {
log.Critical(err.Error())
}
close(done)
}
}()
return done
}