You’re getting close! But because the dry-monitor classes are autoloaded via Zeitwerk, a single require "dry-monitor" isn’t quite enough. You’ll want one of these, I think:
require "dry/monitor"
require "dry/monitor/sql/logger"
module Dry
module Monitor
module SQL
class Logger
def log_query(time:, name:, query:); end
end
end
end
end
or:
require "dry/monitor"
Dry::Monitor::SQL::Logger.class_eval do
def log_query(time:, name:, query:); end
end
The second is probably the nicer approach for a patch. It will give you early feedback e.g. if for any reason the full Dry::Monitor::SQL::Logger class is no longer available, whereas the code in first approach would end up continuing to execute (but do nothing) in the case of the underlying dry-monitor classes changing.