summaryrefslogtreecommitdiff
path: root/src/mongo/db/geo
diff options
context:
space:
mode:
authorGabriel Russell <gabriel.russell@mongodb.com>2020-02-13 11:49:46 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-02-13 18:16:35 +0000
commita84c09a19720b73cedb2e8ef7c5cfeedfa1c9761 (patch)
tree85ac46cd5f4ea6d5134560bf764fb9e6cf11fe4e /src/mongo/db/geo
parent6df40e01f7b6899affc4536e7e73a35802cabf98 (diff)
downloadmongo-a84c09a19720b73cedb2e8ef7c5cfeedfa1c9761.tar.gz
SERVER-45869 automatically converted structured logging
Diffstat (limited to 'src/mongo/db/geo')
-rw-r--r--src/mongo/db/geo/r2_region_coverer.cpp17
-rw-r--r--src/mongo/db/geo/r2_region_coverer_test.cpp15
2 files changed, 24 insertions, 8 deletions
diff --git a/src/mongo/db/geo/r2_region_coverer.cpp b/src/mongo/db/geo/r2_region_coverer.cpp
index 284350f62ab..c1c6b06c28d 100644
--- a/src/mongo/db/geo/r2_region_coverer.cpp
+++ b/src/mongo/db/geo/r2_region_coverer.cpp
@@ -35,6 +35,7 @@
#include "mongo/db/geo/r2_region_coverer.h"
#include "mongo/db/geo/shapes.h"
+#include "mongo/logv2/log.h"
#include "mongo/util/log.h"
namespace mongo {
@@ -108,7 +109,10 @@ void R2RegionCoverer::getCovering(const R2Region& region, vector<GeoHash>* cover
Candidate* candidate = _candidateQueue->top().second; // Owned
_candidateQueue->pop();
// REDACT?? I think this may have User info, but I'm not sure how to redact
- LOG(3) << "Pop: " << redact(candidate->cell.toString());
+ LOGV2_DEBUG(20637,
+ 3,
+ "Pop: {candidate_cell}",
+ "candidate_cell"_attr = redact(candidate->cell.toString()));
// Try to expand this cell into its children
if (candidate->cell.getBits() < _minLevel || candidate->numChildren == 1 ||
@@ -123,7 +127,10 @@ void R2RegionCoverer::getCovering(const R2Region& region, vector<GeoHash>* cover
candidate->isTerminal = true;
addCandidate(candidate);
}
- LOG(3) << "Queue: " << _candidateQueue->size();
+ LOGV2_DEBUG(20638,
+ 3,
+ "Queue: {candidateQueue_size}",
+ "candidateQueue_size"_attr = _candidateQueue->size());
}
_region = nullptr;
@@ -185,7 +192,11 @@ void R2RegionCoverer::addCandidate(Candidate* candidate) {
numTerminals);
_candidateQueue->push(make_pair(priority, candidate)); // queue owns candidate
// REDACT??
- LOG(3) << "Push: " << redact(candidate->cell.toString()) << " (" << priority << ") ";
+ LOGV2_DEBUG(20639,
+ 3,
+ "Push: {candidate_cell} ({priority}) ",
+ "candidate_cell"_attr = redact(candidate->cell.toString()),
+ "priority"_attr = priority);
}
}
diff --git a/src/mongo/db/geo/r2_region_coverer_test.cpp b/src/mongo/db/geo/r2_region_coverer_test.cpp
index d569cb78ce1..394698b1d47 100644
--- a/src/mongo/db/geo/r2_region_coverer_test.cpp
+++ b/src/mongo/db/geo/r2_region_coverer_test.cpp
@@ -38,6 +38,7 @@
#include "mongo/base/init.h"
#include "mongo/bson/bsonmisc.h"
#include "mongo/db/geo/geometry_container.h"
+#include "mongo/logv2/log.h"
#include "mongo/platform/random.h"
#include "mongo/unittest/unittest.h"
#include "mongo/util/log.h"
@@ -58,7 +59,7 @@ MONGO_INITIALIZER(R2CellUnion_Test)(InitializerContext* context) {
}
}
generator.seed(seed);
- log() << "R2CellUnion Test - Random Number Generator Seed: " << seed;
+ LOGV2(20640, "R2CellUnion Test - Random Number Generator Seed: {seed}", "seed"_attr = seed);
return Status::OK();
}
@@ -226,8 +227,8 @@ void checkCellIdCovering(const GeoHashConverter& converter,
// The covering doesn't contain this cell, so the region shouldn't contain this cell.
if (region.fastContains(cell)) {
- log() << "covering " << covering.toString();
- log() << "cellId " << cellId;
+ LOGV2(20641, "covering {covering}", "covering"_attr = covering.toString());
+ LOGV2(20642, "cellId {cellId}", "cellId"_attr = cellId);
}
ASSERT_FALSE(region.fastContains(cell));
@@ -726,8 +727,12 @@ TEST(R2CellUnion, Normalize) {
ASSERT_EQUALS(expected[i], cellUnion.cellIds()[i]);
}
}
- log() << "Average Unnormalized Size: " << unnormalizedSum * 1.0 / kIters;
- log() << "Average Normalized Size: " << normalizedSum * 1.0 / kIters;
+ LOGV2(20643,
+ "Average Unnormalized Size: {unnormalizedSum_1_0_kIters}",
+ "unnormalizedSum_1_0_kIters"_attr = unnormalizedSum * 1.0 / kIters);
+ LOGV2(20644,
+ "Average Normalized Size: {normalizedSum_1_0_kIters}",
+ "normalizedSum_1_0_kIters"_attr = normalizedSum * 1.0 / kIters);
}
void testContains(const R2CellUnion& cellUnion, GeoHash id, int num) {