Commit 31de6510 authored by slene's avatar slene Committed by astaxie

beego: fix log output when SetLogger has error

parent f4d62d31
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment