Skip to content

Commit

Permalink
Polishing.
Browse files Browse the repository at this point in the history
Consistent log field ordering, serialize sort safely.

See #4686
Original pull request: #4679
  • Loading branch information
mp911de committed Apr 10, 2024
1 parent 808d282 commit f2f81e8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,8 @@ protected void executeQuery(Query query, String collectionName, DocumentCallback
Document fieldsObject = query.getFieldsObject();

if (LOGGER.isDebugEnabled()) {
LOGGER.debug(String.format("Executing query: %s sort: %s fields: %s in collection: %s",
serializeToJsonSafely(queryObject), sortObject, fieldsObject, collectionName));
LOGGER.debug(String.format("Executing query: %s fields: %s sort: %s in collection: %s",
serializeToJsonSafely(queryObject), fieldsObject, serializeToJsonSafely(sortObject), collectionName));
}

this.executeQueryInternal(new FindCallback(createDelegate(query), queryObject, fieldsObject, null),
Expand Down Expand Up @@ -2599,7 +2599,8 @@ protected <S, T> List<T> doFind(String collectionName,

if (LOGGER.isDebugEnabled()) {
LOGGER.debug(String.format("find using query: %s fields: %s sort: %s for class: %s in collection: %s",
serializeToJsonSafely(mappedQuery), mappedSort, mappedFields, entityClass, collectionName));
serializeToJsonSafely(mappedQuery), mappedFields, serializeToJsonSafely(mappedSort), entityClass,
collectionName));
}

return executeFindMultiInternal(new FindCallback(collectionPreparer, mappedQuery, mappedFields, null),
Expand All @@ -2625,7 +2626,8 @@ <S, T> List<T> doFind(CollectionPreparer<MongoCollection<Document>> collectionPr

if (LOGGER.isDebugEnabled()) {
LOGGER.debug(String.format("find using query: %s fields: %s sort: %s for class: %s in collection: %s",
serializeToJsonSafely(mappedQuery), mappedSort, mappedFields, sourceClass, collectionName));
serializeToJsonSafely(mappedQuery), mappedFields, serializeToJsonSafely(mappedSort), sourceClass,
collectionName));
}

return executeFindMultiInternal(new FindCallback(collectionPreparer, mappedQuery, mappedFields, null), preparer,
Expand Down Expand Up @@ -2707,7 +2709,7 @@ protected <T> T doFindAndRemove(CollectionPreparer collectionPreparer, String co

if (LOGGER.isDebugEnabled()) {
LOGGER.debug(String.format("findAndRemove using query: %s fields: %s sort: %s for class: %s in collection: %s",
serializeToJsonSafely(query), fields, sort, entityClass, collectionName));
serializeToJsonSafely(query), fields, serializeToJsonSafely(sort), entityClass, collectionName));
}

MongoPersistentEntity<?> entity = mappingContext.getPersistentEntity(entityClass);
Expand Down Expand Up @@ -2738,7 +2740,8 @@ protected <T> T doFindAndModify(CollectionPreparer collectionPreparer, String co
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(String.format(
"findAndModify using query: %s fields: %s sort: %s for class: %s and update: %s in collection: %s",
serializeToJsonSafely(mappedQuery), fields, sort, entityClass, serializeToJsonSafely(mappedUpdate),
serializeToJsonSafely(mappedQuery), fields, serializeToJsonSafely(sort), entityClass,
serializeToJsonSafely(mappedUpdate),
collectionName));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2458,7 +2458,7 @@ protected <T> Mono<T> doFindAndRemove(String collectionName,

if (LOGGER.isDebugEnabled()) {
LOGGER.debug(String.format("findAndRemove using query: %s fields: %s sort: %s for class: %s in collection: %s",
serializeToJsonSafely(query), fields, sort, entityClass, collectionName));
serializeToJsonSafely(query), fields, serializeToJsonSafely(sort), entityClass, collectionName));
}

MongoPersistentEntity<?> entity = mappingContext.getPersistentEntity(entityClass);
Expand All @@ -2485,7 +2485,8 @@ protected <T> Mono<T> doFindAndModify(String collectionName,
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(String.format(
"findAndModify using query: %s fields: %s sort: %s for class: %s and update: %s " + "in collection: %s",
serializeToJsonSafely(mappedQuery), fields, sort, entityClass, serializeToJsonSafely(mappedUpdate),
serializeToJsonSafely(mappedQuery), fields, serializeToJsonSafely(sort), entityClass,
serializeToJsonSafely(mappedUpdate),
collectionName));
}

Expand Down Expand Up @@ -2552,7 +2553,7 @@ private <T> Mono<T> doFindAndReplace(String collectionName,
LOGGER.debug(String.format(
"findAndReplace using query: %s fields: %s sort: %s for class: %s and replacement: %s "
+ "in collection: %s",
serializeToJsonSafely(mappedQuery), mappedFields, mappedSort, entityType,
serializeToJsonSafely(mappedQuery), mappedFields, serializeToJsonSafely(mappedSort), entityType,
serializeToJsonSafely(replacement), collectionName));
}

Expand Down

0 comments on commit f2f81e8

Please sign in to comment.