mirror of
https://github.com/astaxie/beego.git
synced 2024-12-25 07:40:48 +00:00
Add error returning to writeln
This commit is contained in:
parent
fc56c562db
commit
d8724cb122
@ -63,7 +63,10 @@ func (c *connWriter) WriteMsg(when time.Time, msg string, level int) error {
|
||||
defer c.innerWriter.Close()
|
||||
}
|
||||
|
||||
c.lg.writeln(when, msg)
|
||||
_, err := c.lg.writeln(when, msg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -30,11 +30,12 @@ func newLogWriter(wr io.Writer) *logWriter {
|
||||
return &logWriter{writer: wr}
|
||||
}
|
||||
|
||||
func (lg *logWriter) writeln(when time.Time, msg string) {
|
||||
func (lg *logWriter) writeln(when time.Time, msg string) (int, error) {
|
||||
lg.Lock()
|
||||
h, _, _ := formatTimeHeader(when)
|
||||
lg.writer.Write(append(append(h, msg...), '\n'))
|
||||
n, err := lg.writer.Write(append(append(h, msg...), '\n'))
|
||||
lg.Unlock()
|
||||
return n, err
|
||||
}
|
||||
|
||||
const (
|
||||
|
Loading…
Reference in New Issue
Block a user