Skip to content

Commit

Permalink
log: application debug logs should be still disabled until debug is e…
Browse files Browse the repository at this point in the history
…nabled
  • Loading branch information
bagage committed Jan 18, 2016
1 parent 19fe1bd commit bda8fb6
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Classes/Utils/Log.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,20 @@ + (void)log:(OrtpLogLevel)severity file:(const char *)file line:(int)line format
levelC = 'W';
} else if ((severity & ORTP_MESSAGE) != 0) {
levelC = 'I';
} else if (((severity & ORTP_TRACE) != 0) || ((severity & ORTP_DEBUG) != 0)) {
} else if ((severity & ORTP_DEBUG) != 0) {
levelC = 'D';
}
// we want application logs to be always enabled so use | ORTP_ERROR extra mask
ortp_log(severity | ORTP_ERROR, "%c %*s:%3d - %s", levelC, filesize,
filename + MAX((int)strlen(filename) - filesize, 0), line, utf8str);

if ((severity & ORTP_DEBUG) != 0) {
// lol: ortp_debug(XXX) can be disabled at compile time, but ortp_log(ORTP_DEBUG, xxx) will always be valid even
// not in debug build...
ortp_debug("%c %*s:%3d - %s", levelC, filesize, filename + MAX((int)strlen(filename) - filesize, 0), line,
utf8str);
} else {
// we want application logs to be always enabled (except debug ones) so use | ORTP_ERROR extra mask
ortp_log(severity | ORTP_ERROR, "%c %*s:%3d - %s", levelC, filesize,
filename + MAX((int)strlen(filename) - filesize, 0), line, utf8str);
}
va_end(args);
}

Expand Down

0 comments on commit bda8fb6

Please sign in to comment.