MCPcopy Create free account
hub / github.com/Cyinx/einx / doRun

Method doRun

slog/slog_write.go:115–148  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

113}
114
115func (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 }
146wait_close:
147 this.DoClose()
148}
149
150func (this *LogWriter) Recover() {
151 if r := recover(); r != nil {

Callers 1

RunMethod · 0.95

Calls 8

MakeLogTimePathMethod · 0.95
writeFileMethod · 0.95
writeStdMethod · 0.95
ResetMethod · 0.95
DoCloseMethod · 0.95
formatHeaderFunction · 0.85
DebugLevelFunction · 0.85
PutMethod · 0.45

Tested by

no test coverage detected