mirror of
https://github.com/astaxie/beego.git
synced 2024-11-24 20:20:56 +00:00
beego: fix log output when SetLogger has error
This commit is contained in:
parent
f4d62d3193
commit
31de651053
@ -29,6 +29,9 @@ func NewConn() LoggerInterface {
|
|||||||
// init connection writer with json config.
|
// init connection writer with json config.
|
||||||
// json config only need key "level".
|
// json config only need key "level".
|
||||||
func (c *ConnWriter) Init(jsonconfig string) error {
|
func (c *ConnWriter) Init(jsonconfig string) error {
|
||||||
|
if len(jsonconfig) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
err := json.Unmarshal([]byte(jsonconfig), c)
|
err := json.Unmarshal([]byte(jsonconfig), c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -90,6 +90,9 @@ func NewFileWriter() LoggerInterface {
|
|||||||
// "rotate":true
|
// "rotate":true
|
||||||
// }
|
// }
|
||||||
func (w *FileLogWriter) Init(jsonconfig string) error {
|
func (w *FileLogWriter) Init(jsonconfig string) error {
|
||||||
|
if len(jsonconfig) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
err := json.Unmarshal([]byte(jsonconfig), w)
|
err := json.Unmarshal([]byte(jsonconfig), w)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -38,6 +38,9 @@ func NewSmtpWriter() LoggerInterface {
|
|||||||
// "level":LevelError
|
// "level":LevelError
|
||||||
// }
|
// }
|
||||||
func (s *SmtpWriter) Init(jsonconfig string) error {
|
func (s *SmtpWriter) Init(jsonconfig string) error {
|
||||||
|
if len(jsonconfig) == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
err := json.Unmarshal([]byte(jsonconfig), s)
|
err := json.Unmarshal([]byte(jsonconfig), s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user