Skip to content

Commit

Permalink
fix(ios): fix ConsoleModule.log not working (Tencent#2812)
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwcg committed May 12, 2023
1 parent 5e724e4 commit a32d4e9
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions modules/footstone/src/platform/ios/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ namespace {
const char* const kLogSeverityNames[TDF_LOG_NUM_SEVERITIES] = {"INFO", "WARNING", "ERROR", "FATAL"};

const char* GetNameForLogSeverity(LogSeverity severity) {
if (severity >= LOG_INFO && severity < TDF_LOG_NUM_SEVERITIES) return kLogSeverityNames[severity];
if (severity >= TDF_LOG_INFO && severity < TDF_LOG_NUM_SEVERITIES) {
return kLogSeverityNames[severity];
}
return "UNKNOWN";
}

Expand Down Expand Up @@ -63,11 +65,12 @@ std::mutex LogMessage::mutex_;
LogMessage::LogMessage(LogSeverity severity, const char* file, int line, const char* condition)
: severity_(severity), file_(file), line_(line) {
stream_ << "[";
if (severity >= LOG_INFO)
if (severity >= TDF_LOG_INFO) {
stream_ << GetNameForLogSeverity(severity);
else
stream_ << "VERBOSE" << -severity;
stream_ << ":" << (severity > LOG_INFO ? StripDots(file_) : StripPath(file_)) << "(" << line_
} else {
stream_ << "VERBOSE" << -severity;
}
stream_ << ":" << (severity > TDF_LOG_INFO ? StripDots(file_) : StripPath(file_)) << "(" << line_
<< ")] ";

if (condition) stream_ << "Check failed: " << condition << ". ";
Expand Down

0 comments on commit a32d4e9

Please sign in to comment.