mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
Don't include base/logging.h for SPM builds
PiperOrigin-RevId: 438453534
This commit is contained in:
committed by
Copybara-Service
parent
267afabefd
commit
4e1c8c8222
@@ -15,7 +15,11 @@
|
||||
#ifndef PLATFORM_IMPL_IOS_LOG_MESSAGE_H_
|
||||
#define PLATFORM_IMPL_IOS_LOG_MESSAGE_H_
|
||||
|
||||
#ifdef NEARBY_SWIFTPM
|
||||
#include <sstream>
|
||||
#else
|
||||
#include "glog/logging.h"
|
||||
#endif
|
||||
#include "internal/platform/implementation/log_message.h"
|
||||
|
||||
namespace location {
|
||||
@@ -36,7 +40,11 @@ class LogMessage : public api::LogMessage {
|
||||
std::ostream& Stream() override;
|
||||
|
||||
private:
|
||||
#ifdef NEARBY_SWIFTPM
|
||||
std::stringstream log_streamer_;
|
||||
#else
|
||||
google::LogMessage log_streamer_;
|
||||
#endif
|
||||
api::LogMessage::Severity severity_;
|
||||
};
|
||||
|
||||
|
||||
@@ -14,7 +14,9 @@
|
||||
|
||||
#include "internal/platform/implementation/ios/Source/Platform/log_message.h"
|
||||
|
||||
#ifndef NEARBY_SWIFTPM
|
||||
#include "glog/logging.h"
|
||||
#endif
|
||||
#include "internal/platform/implementation/log_message.h"
|
||||
#include "GoogleToolboxForMac/GTMLogger.h"
|
||||
|
||||
@@ -40,7 +42,11 @@ GTMLoggerLevel ConvertSeverity(api::LogMessage::Severity severity) {
|
||||
}
|
||||
|
||||
LogMessage::LogMessage(const char* file, int line, Severity severity)
|
||||
#ifdef NEARBY_SWIFTPM
|
||||
: log_streamer_() {}
|
||||
#else
|
||||
: log_streamer_(ConvertSeverity(severity), file, line), severity_(severity) {}
|
||||
#endif
|
||||
|
||||
void LogMessage::Print(const char* format, ...) {
|
||||
va_list ap;
|
||||
@@ -66,7 +72,11 @@ void LogMessage::Print(const char* format, ...) {
|
||||
|
||||
// TODO(b/169292092): GTMLogger doesn't support stream. Temporarily use absl LogStreamer to make
|
||||
// build pass.
|
||||
#ifdef NEARBY_SWIFTPM
|
||||
std::ostream& LogMessage::Stream() { return log_streamer_; }
|
||||
#else
|
||||
std::ostream& LogMessage::Stream() { return log_streamer_.stream(); }
|
||||
#endif
|
||||
|
||||
} // namespace ios
|
||||
|
||||
|
||||
@@ -19,6 +19,14 @@
|
||||
// In Chrome this is base/check.h. See crbug/1212611.
|
||||
#ifdef NEARBY_CHROMIUM
|
||||
#include "base/check.h"
|
||||
// base/logging.h is available externally as "glog". However, this repo contains
|
||||
// template files that can't be built by Swift Package Manager. To build with
|
||||
// SPM we only need CHECK and DCHECK defined.
|
||||
#elif defined(NEARBY_SWIFTPM)
|
||||
#include <sstream>
|
||||
#define CHECK(condition) static_cast<void>(0), condition ? (void) 0 : abort()
|
||||
#define DCHECK(condition) static_cast<void>(0), (void) 0
|
||||
#define CHECK_GT(a, b) static_cast<void>(0), a > b ? (void) 0 : abort()
|
||||
#else
|
||||
#include "glog/logging.h"
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user