aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Example
diff options
context:
space:
mode:
authorGravatar Gil <mcg@google.com>2018-05-23 07:00:05 -0700
committerGravatar GitHub <noreply@github.com>2018-05-23 07:00:05 -0700
commitaf19a1b07245b7d0be4fd492bd3731964937c7c6 (patch)
treee19db1c38a0de792ef8f49b259f34d0dab252fb1 /Firestore/Example
parent23f8320148672310ff71aa3ef2b6c3ac86d47ede (diff)
Reimplement C++ logging (#1313)
* Add direct support for formatting Objective-C objects * Rewrite log.h * Convert FSTWarn to LOG_WARN * Convert FSTLog to LOG_DEBUG * Remove FSTLogger
Diffstat (limited to 'Firestore/Example')
-rw-r--r--Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm6
-rw-r--r--Firestore/Example/Tests/SpecTests/FSTSpecTests.mm4
-rw-r--r--Firestore/Example/Tests/SpecTests/FSTSyncEngineTestDriver.mm10
3 files changed, 10 insertions, 10 deletions
diff --git a/Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm b/Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm
index dd34556..c846ec5 100644
--- a/Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm
+++ b/Firestore/Example/Tests/SpecTests/FSTMockDatastore.mm
@@ -21,7 +21,6 @@
#import "Firestore/Source/Remote/FSTSerializerBeta.h"
#import "Firestore/Source/Remote/FSTStream.h"
#import "Firestore/Source/Util/FSTAssert.h"
-#import "Firestore/Source/Util/FSTLogger.h"
#import "Firestore/Example/Tests/Remote/FSTWatchChange+Testing.h"
@@ -29,6 +28,7 @@
#include "Firestore/core/src/firebase/firestore/auth/empty_credentials_provider.h"
#include "Firestore/core/src/firebase/firestore/core/database_info.h"
#include "Firestore/core/src/firebase/firestore/model/database_id.h"
+#include "Firestore/core/src/firebase/firestore/util/log.h"
#include "Firestore/core/src/firebase/firestore/util/string_apple.h"
using firebase::firestore::auth::CredentialsProvider;
@@ -117,7 +117,7 @@ NS_ASSUME_NONNULL_BEGIN
}
- (void)watchQuery:(FSTQueryData *)query {
- FSTLog(@"watchQuery: %d: %@", query.targetID, query.query);
+ LOG_DEBUG("watchQuery: %s: %s", query.targetID, query.query);
self.datastore.watchStreamRequestCount += 1;
// Snapshot version is ignored on the wire
FSTQueryData *sentQueryData = [query queryDataByReplacingSnapshotVersion:SnapshotVersion::None()
@@ -127,7 +127,7 @@ NS_ASSUME_NONNULL_BEGIN
}
- (void)unwatchTargetID:(FSTTargetID)targetID {
- FSTLog(@"unwatchTargetID: %d", targetID);
+ LOG_DEBUG("unwatchTargetID: %s", targetID);
[self.activeTargets removeObjectForKey:@(targetID)];
}
diff --git a/Firestore/Example/Tests/SpecTests/FSTSpecTests.mm b/Firestore/Example/Tests/SpecTests/FSTSpecTests.mm
index 5a7cb72..7b10bd4 100644
--- a/Firestore/Example/Tests/SpecTests/FSTSpecTests.mm
+++ b/Firestore/Example/Tests/SpecTests/FSTSpecTests.mm
@@ -37,7 +37,6 @@
#import "Firestore/Source/Util/FSTAssert.h"
#import "Firestore/Source/Util/FSTClasses.h"
#import "Firestore/Source/Util/FSTDispatchQueue.h"
-#import "Firestore/Source/Util/FSTLogger.h"
#import "Firestore/Example/Tests/Remote/FSTWatchChange+Testing.h"
#import "Firestore/Example/Tests/SpecTests/FSTSyncEngineTestDriver.h"
@@ -46,6 +45,7 @@
#include "Firestore/core/src/firebase/firestore/auth/user.h"
#include "Firestore/core/src/firebase/firestore/model/document_key.h"
#include "Firestore/core/src/firebase/firestore/model/snapshot_version.h"
+#include "Firestore/core/src/firebase/firestore/util/log.h"
#include "Firestore/core/src/firebase/firestore/util/string_apple.h"
#include "Firestore/core/test/firebase/firestore/testutil/testutil.h"
@@ -620,7 +620,7 @@ static NSString *const kNoIOSTag = @"no-ios";
@try {
[self setUpForSpecWithConfig:config];
for (NSDictionary *step in steps) {
- FSTLog(@"Doing step %@", step);
+ LOG_DEBUG("Doing step %s", step);
[self doStep:step];
[self validateStepExpectations:step[@"expect"]];
[self validateStateExpectations:step[@"stateExpect"]];
diff --git a/Firestore/Example/Tests/SpecTests/FSTSyncEngineTestDriver.mm b/Firestore/Example/Tests/SpecTests/FSTSyncEngineTestDriver.mm
index 2aa0e30..40ebfb9 100644
--- a/Firestore/Example/Tests/SpecTests/FSTSyncEngineTestDriver.mm
+++ b/Firestore/Example/Tests/SpecTests/FSTSyncEngineTestDriver.mm
@@ -31,7 +31,6 @@
#import "Firestore/Source/Remote/FSTDatastore.h"
#import "Firestore/Source/Remote/FSTWatchChange.h"
#import "Firestore/Source/Util/FSTAssert.h"
-#import "Firestore/Source/Util/FSTLogger.h"
#import "Firestore/Example/Tests/Core/FSTSyncEngine+Testing.h"
#import "Firestore/Example/Tests/SpecTests/FSTMockDatastore.h"
@@ -41,6 +40,7 @@
#include "Firestore/core/src/firebase/firestore/core/database_info.h"
#include "Firestore/core/src/firebase/firestore/model/database_id.h"
#include "Firestore/core/src/firebase/firestore/model/document_key.h"
+#include "Firestore/core/src/firebase/firestore/util/log.h"
using firebase::firestore::auth::EmptyCredentialsProvider;
using firebase::firestore::auth::HashUser;
@@ -202,7 +202,7 @@ NS_ASSUME_NONNULL_BEGIN
FSTAssert([actualWrite isEqual:expectedWrite],
@"Mock datastore received write %@ but first outstanding mutation was %@", actualWrite,
expectedWrite);
- FSTLog(@"A write was sent: %@", actualWrite);
+ LOG_DEBUG("A write was sent: %s", actualWrite);
}
- (int)sentWritesCount {
@@ -271,7 +271,7 @@ NS_ASSUME_NONNULL_BEGIN
[[self currentOutstandingWrites] removeObjectAtIndex:0];
}
- FSTLog(@"Failing a write.");
+ LOG_DEBUG("Failing a write.");
[self.dispatchQueue dispatchSync:^{
[self.datastore failWriteWithError:error];
}];
@@ -321,11 +321,11 @@ NS_ASSUME_NONNULL_BEGIN
FSTOutstandingWrite *write = [[FSTOutstandingWrite alloc] init];
write.write = mutation;
[[self currentOutstandingWrites] addObject:write];
- FSTLog(@"sending a user write.");
+ LOG_DEBUG("sending a user write.");
[self.dispatchQueue dispatchSync:^{
[self.syncEngine writeMutations:@[ mutation ]
completion:^(NSError *_Nullable error) {
- FSTLog(@"A callback was called with error: %@", error);
+ LOG_DEBUG("A callback was called with error: %s", error);
write.done = YES;
write.error = error;
}];