本文整理匯總了Golang中mozilla/org/util.HekaLogger.Critical方法的典型用法代碼示例。如果您正苦於以下問題:Golang HekaLogger.Critical方法的具體用法?Golang HekaLogger.Critical怎麽用?Golang HekaLogger.Critical使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mozilla/org/util.HekaLogger
的用法示例。
在下文中一共展示了HekaLogger.Critical方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: newMC
// Generate a new Memcache Client
func newMC(servers []string, config util.JsMap, logger *util.HekaLogger) (mc gomc.Client) {
var err error
/* if mcsPoolSize >= mcsMaxPoolSize {
return nil
}
*/
mc, err = gomc.NewClient(servers, 1, gomc.ENCODING_GOB)
if err != nil {
logger.Critical("storage", "CRITICAL HIT!",
util.Fields{"error": err.Error()})
}
// internally hash key using MD5 (for key distribution)
mc.SetBehavior(gomc.BEHAVIOR_KETAMA_HASH, 1)
// Use the binary protocol, which allows us faster data xfer
// and better data storage (can use full UTF-8 char space)
mc.SetBehavior(gomc.BEHAVIOR_BINARY_PROTOCOL, 1)
//mc.SetBehavior(gomc.BEHAVIOR_NO_BLOCK, 1)
// NOTE! do NOT set BEHAVIOR_NOREPLY + Binary. This will cause
// libmemcache to drop into an infinite loop.
if v, ok := config["memcache.recv_timeout"]; ok {
d, err := time.ParseDuration(v.(string))
if err == nil {
mc.SetBehavior(gomc.BEHAVIOR_SND_TIMEOUT,
uint64(d.Nanoseconds()*1000))
}
}
if v, ok := config["memcache.send_timeout"]; ok {
d, err := time.ParseDuration(v.(string))
if err == nil {
mc.SetBehavior(gomc.BEHAVIOR_RCV_TIMEOUT,
uint64(d.Nanoseconds()*1000))
}
}
if v, ok := config["memcache.poll_timeout"]; ok {
d, err := time.ParseDuration(v.(string))
if err == nil {
mc.SetBehavior(gomc.BEHAVIOR_POLL_TIMEOUT,
uint64(d.Nanoseconds()*1000))
}
}
if v, ok := config["memcache.retry_timeout"]; ok {
d, err := time.ParseDuration(v.(string))
if err == nil {
mc.SetBehavior(gomc.BEHAVIOR_RETRY_TIMEOUT,
uint64(d.Nanoseconds()*1000))
}
}
atomic.AddInt32(&mcsPoolSize, 1)
return mc
}