| 158 | } |
| 159 | |
| 160 | void tlog(int level, const char *msg, ...) // log line from other-than-main thread (may block) |
| 161 | { |
| 162 | ASSERT(level >= 0 && level < ACLOG_NUM && !ismainthread()); |
| 163 | if(!loglevelenabled[level]) return; |
| 164 | threadlogsem.wait(); // properly lock, so different threads can use this |
| 165 | while(threadlog.full()) threadlogfullsem.wait(); // wait for buffer to clear |
| 166 | logline_s *ll = threadlog.stage(new logline_s); |
| 167 | vformatstring(ll->msg, msg, msg); |
| 168 | filtertext(ll->msg, ll->msg, FTXT__LOG); |
| 169 | ll->t = time(NULL); |
| 170 | ll->level = level; |
| 171 | threadlog.commit(); |
| 172 | threadlogsem.post(); |
| 173 | } |
| 174 | |
| 175 | void xlog(int level, const char *msg, ...) // log line from any thread (more expensive: only use for functions, that are called from main and other threads) |
| 176 | { |
no test coverage detected