修改开发/测试环境写日志方式
This commit is contained in:
parent
30b584f0bd
commit
33161d92ac
8
log.go
8
log.go
@ -141,6 +141,12 @@ func init() {
|
||||
}
|
||||
|
||||
defaultModeMapping["es"] = []AdapterTupple{{level, AdapterConsole}, {level, AdapterElasticSearch}}
|
||||
defaultModeMapping["ali"] = []AdapterTupple{{level, AdapterConsole}, {level, AdapterAliLs}}
|
||||
defaultModeMapping[""] = []AdapterTupple{{level, AdapterConsole}, {level, AdapterFile}}
|
||||
defaultModeMapping["ali"] = []AdapterTupple{{level, AdapterConsole}}
|
||||
env := os.Getenv(envKey)
|
||||
if env == "production" || env == "gray" || os.Getenv("GRLOG_INTERNET") == "public" {
|
||||
defaultModeMapping["ali"] = append(defaultModeMapping["ali"], AdapterTupple{level, AdapterAliLs})
|
||||
} else {
|
||||
defaultModeMapping["ali"] = append(defaultModeMapping["ali"], AdapterTupple{level, AdapterFile})
|
||||
}
|
||||
}
|
||||
|
@ -63,12 +63,11 @@ func TestDropAdapter(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNew(t *testing.T) {
|
||||
os.Setenv("GRLOG_INTERNET", "public")
|
||||
os.Setenv("GAORE_ENVIRONMENT", "development")
|
||||
os.Setenv("CENTER_RUNMODE", "dev")
|
||||
os.Setenv("GRLOG_APP_NAME", "yoda")
|
||||
os.Setenv("GRLOG_ALILS_DEBUG", "on")
|
||||
t.Log(os.Getenv("GRLOG_INTERNET"))
|
||||
t.Log("GRLOG_INTERNET:" + os.Getenv("GRLOG_INTERNET"))
|
||||
t.Log("GAORE_ENVIRONMENT:" + os.Getenv("GAORE_ENVIRONMENT"))
|
||||
wg := sync.WaitGroup{}
|
||||
for i := 0; i < 10; i++ {
|
||||
wg.Add(1)
|
||||
|
@ -81,7 +81,7 @@ func newFileWriter() Logger {
|
||||
Rotate: true,
|
||||
RotatePerm: "0440",
|
||||
Level: LevelTrace,
|
||||
Perm: "0660",
|
||||
Perm: "0755",
|
||||
MaxLines: 10000000,
|
||||
MaxFiles: 999,
|
||||
MaxSize: 1 << 28,
|
||||
@ -91,6 +91,7 @@ func newFileWriter() Logger {
|
||||
|
||||
// Init file logger with json config.
|
||||
// jsonConfig like:
|
||||
//
|
||||
// {
|
||||
// "filename":"logs/beego.log",
|
||||
// "maxLines":10000,
|
||||
|
Loading…
Reference in New Issue
Block a user