Skip to content

Commit 08d8433

Browse files
committed
Use Logger#log_warn for Aggregation and MapReduce reroute warnings.
1 parent 5e56e9a commit 08d8433

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/mongo/collection/view/aggregation.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ def send_initial_query(server)
110110
begin
111111
initial_query_op.execute(server.context)
112112
rescue Mongo::Error::NeedPrimaryServer
113-
warn 'Rerouting the Aggregation operation to the primary server.'
113+
log_warn([
114+
'Rerouting the Aggregation operation to the primary server.'
115+
])
114116
server = ServerSelector.get(mode: :primary).select_server(cluster)
115117
initial_query_op.execute(server.context)
116118
end

lib/mongo/collection/view/map_reduce.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,9 @@ def send_initial_query(server)
177177
begin
178178
initial_query_op.execute(server.context)
179179
rescue Mongo::Error::NeedPrimaryServer
180-
warn 'Rerouting the MapReduce operation to the primary server.'
180+
log_warn([
181+
'Rerouting the MapReduce operation to the primary server.'
182+
])
181183
server = ServerSelector.get(mode: :primary).select_server(cluster)
182184
initial_query_op.execute(server.context)
183185
end

0 commit comments

Comments
 (0)