()
| 113 | } |
| 114 | |
| 115 | func (this *LogWriter) doRun() { |
| 116 | var logRecord *LogRecord |
| 117 | var ok bool |
| 118 | for { |
| 119 | select { |
| 120 | case logRecord, ok = <-this.rec: |
| 121 | case <-this.dayTimer.C: |
| 122 | this.MakeLogTimePath() |
| 123 | continue |
| 124 | } |
| 125 | if ok == false || logRecord == nil { |
| 126 | goto wait_close |
| 127 | } |
| 128 | this.buf = this.buf[:0] |
| 129 | //_log_writer.buf = append(_log_writer.buf, "\x1b[031m"...) |
| 130 | formatHeader(&this.buf, logRecord.Level, logRecord.Created) |
| 131 | this.buf = append(this.buf, logRecord.Message...) |
| 132 | //_log_writer.buf = append(_log_writer.buf, "\x1b[0m"...) |
| 133 | this.buf = append(this.buf, "\r\n"...) |
| 134 | |
| 135 | if logRecord.logfile == true { |
| 136 | this.writeFile(logRecord) |
| 137 | } |
| 138 | |
| 139 | if logRecord.Level == INFO || DebugLevel() == DEBUG { |
| 140 | this.writeStd(logRecord) |
| 141 | } |
| 142 | |
| 143 | logRecord.Reset() |
| 144 | log_pool.Put(logRecord) |
| 145 | } |
| 146 | wait_close: |
| 147 | this.DoClose() |
| 148 | } |
| 149 | |
| 150 | func (this *LogWriter) Recover() { |
| 151 | if r := recover(); r != nil { |
no test coverage detected