mirror of
https://github.com/astaxie/beego.git
synced 2024-11-23 15:20:55 +00:00
Merge pull request #4290 from flycash/develop-2.0
fix init error of global instance
This commit is contained in:
commit
20a0de6bd0
@ -14,22 +14,10 @@
|
|||||||
|
|
||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/astaxie/beego/core/logs"
|
|
||||||
)
|
|
||||||
|
|
||||||
// We use this to simply application's development
|
// We use this to simply application's development
|
||||||
// for most users, they only need to use those methods
|
// for most users, they only need to use those methods
|
||||||
var globalInstance Configer
|
var globalInstance Configer
|
||||||
|
|
||||||
func init() {
|
|
||||||
// Ignore this error
|
|
||||||
err := InitGlobalInstance("ini", "config/app.conf")
|
|
||||||
if err != nil {
|
|
||||||
logs.Warn("init global config instance failed. If you donot use this, just ignore it. ", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// InitGlobalInstance will ini the global instance
|
// InitGlobalInstance will ini the global instance
|
||||||
// If you want to use specific implementation, don't forget to import it.
|
// If you want to use specific implementation, don't forget to import it.
|
||||||
|
@ -29,6 +29,8 @@ import (
|
|||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
|
|
||||||
|
"github.com/astaxie/beego/core/logs"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -516,4 +518,11 @@ func (c *IniConfigContainer) Unmarshaler(prefix string, obj interface{}, opt ...
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Register("ini", &IniConfig{})
|
Register("ini", &IniConfig{})
|
||||||
|
|
||||||
|
err := InitGlobalInstance("ini", "config/app.conf")
|
||||||
|
if err != nil {
|
||||||
|
logs.Warn("init global config instance failed. If you donot use this, just ignore it. ", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ignore this error
|
||||||
|
@ -687,7 +687,7 @@ func EnableFuncCallDepth(b bool) {
|
|||||||
// SetLogFuncCall set the CallDepth, default is 4
|
// SetLogFuncCall set the CallDepth, default is 4
|
||||||
func SetLogFuncCall(b bool) {
|
func SetLogFuncCall(b bool) {
|
||||||
beeLogger.EnableFuncCallDepth(b)
|
beeLogger.EnableFuncCallDepth(b)
|
||||||
beeLogger.SetLogFuncCallDepth(4)
|
beeLogger.SetLogFuncCallDepth(3)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetLogFuncCallDepth set log funcCallDepth
|
// SetLogFuncCallDepth set log funcCallDepth
|
||||||
|
@ -39,7 +39,7 @@ import (
|
|||||||
var globalRouterTemplate = `package {{.routersDir}}
|
var globalRouterTemplate = `package {{.routersDir}}
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/astaxie/beego"
|
beego "github.com/astaxie/beego/server/web"
|
||||||
"github.com/astaxie/beego/server/web/context/param"{{.globalimport}}
|
"github.com/astaxie/beego/server/web/context/param"{{.globalimport}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user