本文整理汇总了Golang中gopkg/in/inconshreveable/log15/v2.Logger.Crit方法的典型用法代码示例。如果您正苦于以下问题:Golang Logger.Crit方法的具体用法?Golang Logger.Crit怎么用?Golang Logger.Crit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gopkg/in/inconshreveable/log15/v2.Logger
的用法示例。
在下文中一共展示了Logger.Crit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Init
// Init ...
func (rthink *RethinkDBImpl) Init(conntype string, dbhost string, username string, password string, port int, dbname string, log log.Logger, hosts ...string) error {
var retErr error
if conntype == "cluster" {
session, err := r.Connect(r.ConnectOpts{
Addresses: hosts,
Database: dbname,
AuthKey: password,
})
retErr = err
if err != nil {
log.Crit("Got error when connect database, the error is '%v'", err)
return retErr
}
rthink.Session = session
} else {
session, err := r.Connect(r.ConnectOpts{
Address: dbhost,
Database: dbname,
AuthKey: password,
})
retErr = err
if err != nil {
log.Crit("Got error when connect database, the error is '%v'", err)
return retErr
}
rthink.Session = session
}
fmt.Println("Rethink Connected")
return nil
}
示例2: InitDataStore
// InitDataStore ...
func (datastore *DataStore) InitDataStore(storeType string, connDetails map[string]interface{}, log log.Logger) error {
var err error
datastore.StoreType = storeType
if storeType == "rdbms" {
rdbms := RDBMSImpl{}
err = rdbms.Init(connDetails["dbtype"].(string), connDetails["host"].(string), connDetails["username"].(string), connDetails["password"].(string), int(connDetails["port"].(float64)), connDetails["database"].(string), log)
if err != nil {
log.Crit("Got error when connect database, the error is '%v'", err)
}
datastore.RDBMS = rdbms
}
return err
}