use logrus to project default log tools
This commit is contained in:
+8
-9
@@ -6,11 +6,8 @@ import (
|
||||
"../../hotime/common"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
|
||||
//"go.hoteas.com/hotime/cache"
|
||||
"golang.org/x/net/websocket"
|
||||
"time"
|
||||
//"go.hoteas.com/hotime/cache"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -27,18 +24,18 @@ func main() {
|
||||
//手动模式,
|
||||
appIns.SetConfig("example/config/config.json")
|
||||
//redis缓存接入
|
||||
//ca:=cache.CacheIns(&cache.CacheRedis{Host:appIns.Config.GetString("redisHost"),Pwd:appIns.Config.GetString("redisPwd"),Time:appIns.Config.GetCeilInt64("cacheLongTime")})
|
||||
//ca.Cache("xyzm","dasdas")
|
||||
//ca.Cache("xyzn","dasdas")
|
||||
//ca.Cache("xyzo","dasdas")
|
||||
//ca.Cache("xyz*",nil)
|
||||
ca := cache.CacheIns(&cache.CacheRedis{Host: appIns.Config.GetString("redisHost"), Pwd: appIns.Config.GetString("redisPwd"), Time: appIns.Config.GetCeilInt64("cacheLongTime")})
|
||||
ca.Cache("xyzm", "dasdas")
|
||||
ca.Cache("xyzn", "dasdas")
|
||||
ca.Cache("xyzo", "dasdas")
|
||||
ca.Cache("xyz*", nil)
|
||||
//fmt.Println(ca.Cache("xyzm").Data)
|
||||
//mysql
|
||||
//mysql.SetDB(&appIns)
|
||||
//自动选择数据库
|
||||
dbInterface := cache.HoTimeDBInterface(&appIns.Db)
|
||||
appIns.SetSession(cache.CacheIns(&cache.CacheMemory{}), cache.CacheIns(&cache.CacheDb{Db: dbInterface, Time: appIns.Config.GetInt64("cacheTime")}))
|
||||
//appIns.SetCache(cache.CacheIns(&cache.CacheMemory{}))
|
||||
appIns.SetCache(cache.CacheIns(&cache.CacheMemory{}))
|
||||
|
||||
//快捷模式
|
||||
appIns.SetDefault(func(err ...*common.Error) (*sql.DB, *sql.DB) {
|
||||
@@ -56,6 +53,8 @@ func main() {
|
||||
"index": hotime.Ctr{
|
||||
"test": func(this *hotime.Context) {
|
||||
fmt.Println(this.Db.GetTag())
|
||||
this.Application.Log.Error("dasdasdas")
|
||||
this.Log.Error("dadasdasd")
|
||||
//x:=this.Db.Action(func(db hotime.HoTimeDB) bool {
|
||||
//
|
||||
// db.Insert("user",hotime.Map{"unickname":"dasdas"})
|
||||
|
||||
Reference in New Issue
Block a user