Skip to content

Commit

Permalink
RUBY-1028: Improve performance on log subscriber
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Sep 10, 2015
1 parent a3c48fc commit 7b2e165
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/mongo/monitoring/command_log_subscriber.rb
Expand Up @@ -53,7 +53,9 @@ def initialize(options = {})
#
# @since 2.1.0
def started(event)
log_debug("#{prefix(event)} | STARTED | #{format_command(event.command)}")
if logger.debug?
log_debug("#{prefix(event)} | STARTED | #{format_command(event.command)}")
end
end

# Handle the command succeeded event.
Expand All @@ -65,7 +67,9 @@ def started(event)
#
# @since 2.1.0
def succeeded(event)
log_debug("#{prefix(event)} | SUCCEEDED | #{event.duration}s")
if logger.debug?
log_debug("#{prefix(event)} | SUCCEEDED | #{event.duration}s")
end
end

# Handle the command failed event.
Expand All @@ -77,7 +81,9 @@ def succeeded(event)
#
# @since 2.1.0
def failed(event)
log_debug("#{prefix(event)} | FAILED | #{event.message} | #{event.duration}s")
if logger.debug?
log_debug("#{prefix(event)} | FAILED | #{event.message} | #{event.duration}s")
end
end

private
Expand Down

0 comments on commit 7b2e165

Please sign in to comment.