| 82 | inline pid_t GetTID() { return (pid_t)(uintptr_t)pthread_self(); } |
| 83 | |
| 84 | void LogMessage::GenerateLogMessage() { |
| 85 | time_t rw_time = time(nullptr); |
| 86 | struct tm tm_time; |
| 87 | localtime_r(&rw_time, &tm_time); |
| 88 | // log to a file |
| 89 | for (int i = severity_; i >= 0; --i) |
| 90 | if (log_file[i]) DoLogging(log_file[i], tm_time); |
| 91 | // log to stderr |
| 92 | if (!not_log_stderr[severity_]) DoLogging(stderr, tm_time); |
| 93 | } |
| 94 | |
| 95 | void LogMessage::DoLogging(FILE* file, const struct tm& tm_time) { |
| 96 | fprintf(file, "[%c d%02d%02d t%02d:%02d:%02d p%05d:%03d %s:%d] %s\n", |
nothing calls this directly
no outgoing calls
no test coverage detected