MCPcopy Index your code
hub / github.com/assaultcube/AC / tlog

Function tlog

source/src/log.cpp:160–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160void 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
175void 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{

Callers 1

demoworkerthreadFunction · 0.85

Calls 7

ismainthreadFunction · 0.85
filtertextFunction · 0.85
waitMethod · 0.80
fullMethod · 0.80
stageMethod · 0.80
commitMethod · 0.80
postMethod · 0.80

Tested by

no test coverage detected