1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-25 22:11:29 +00:00

fix the log carsh before init

This commit is contained in:
astaxie 2016-01-06 11:48:23 +08:00
parent f7ef4aa7e5
commit 8929814126
2 changed files with 8 additions and 10 deletions

View File

@ -20,16 +20,15 @@ import (
"path/filepath" "path/filepath"
"strconv" "strconv"
"strings" "strings"
"github.com/astaxie/beego/logs"
) )
const ( const (
// beego web framework version. // VERSION represent beego web framework version.
VERSION = "1.5.0" VERSION = "1.6.0"
// beego run modes // DEV is for develop
DEV = "dev" DEV = "dev"
// PROD is for production
PROD = "prod" PROD = "prod"
) )
@ -75,7 +74,6 @@ func initBeforeHTTPRun() {
panic(err) panic(err)
} }
//init log //init log
BeeLogger = logs.NewLogger(10000)
for adaptor, config := range BConfig.Log.Output { for adaptor, config := range BConfig.Log.Output {
err = BeeLogger.SetLogger(adaptor, config) err = BeeLogger.SetLogger(adaptor, config)
if err != nil { if err != nil {

6
log.go
View File

@ -32,6 +32,9 @@ const (
LevelDebug LevelDebug
) )
// BeeLogger references the used application logger.
var BeeLogger = logs.NewLogger(100)
// SetLevel sets the global log level used by the simple logger. // SetLevel sets the global log level used by the simple logger.
func SetLevel(l int) { func SetLevel(l int) {
BeeLogger.SetLevel(l) BeeLogger.SetLevel(l)
@ -43,9 +46,6 @@ func SetLogFuncCall(b bool) {
BeeLogger.SetLogFuncCallDepth(3) BeeLogger.SetLogFuncCallDepth(3)
} }
// BeeLogger references the used application logger.
var BeeLogger *logs.BeeLogger
// SetLogger sets a new logger. // SetLogger sets a new logger.
func SetLogger(adaptername string, config string) error { func SetLogger(adaptername string, config string) error {
err := BeeLogger.SetLogger(adaptername, config) err := BeeLogger.SetLogger(adaptername, config)