1
0
mirror of https://github.com/astaxie/beego.git synced 2024-12-22 23:00:50 +00:00

beego: fix log output when SetLogger has error

This commit is contained in:
slene 2014-04-04 07:33:13 +08:00 committed by astaxie
parent 9421a21037
commit f48ca96a7e
3 changed files with 9 additions and 0 deletions

View File

@ -29,6 +29,9 @@ func NewConn() LoggerInterface {
// init connection writer with json config.
// json config only need key "level".
func (c *ConnWriter) Init(jsonconfig string) error {
if len(jsonconfig) == 0 {
return nil
}
err := json.Unmarshal([]byte(jsonconfig), c)
if err != nil {
return err

View File

@ -90,6 +90,9 @@ func NewFileWriter() LoggerInterface {
// "rotate":true
// }
func (w *FileLogWriter) Init(jsonconfig string) error {
if len(jsonconfig) == 0 {
return nil
}
err := json.Unmarshal([]byte(jsonconfig), w)
if err != nil {
return err

View File

@ -38,6 +38,9 @@ func NewSmtpWriter() LoggerInterface {
// "level":LevelError
// }
func (s *SmtpWriter) Init(jsonconfig string) error {
if len(jsonconfig) == 0 {
return nil
}
err := json.Unmarshal([]byte(jsonconfig), s)
if err != nil {
return err