lib/dry/monitor/sql/logger.rb in dry-monitor-0.3.1 vs lib/dry/monitor/sql/logger.rb in dry-monitor-0.3.2
- old
+ new
@@ -1,10 +1,10 @@
# frozen_string_literal: true
-require 'dry-configurable'
-require 'dry/core/extensions'
-require 'dry/monitor/notifications'
+require "dry-configurable"
+require "dry/core/extensions"
+require "dry/monitor/notifications"
module Dry
module Monitor
Notifications.register_event(:sql)
@@ -12,22 +12,30 @@
class Logger
extend Dry::Core::Extensions
extend Dry::Configurable
register_extension(:default_colorizer) do
- require_relative './colorizers/default'
+ require_relative "./colorizers/default"
- def colorizer
- @colorizer ||= Colorizers::Default.new(config.theme)
+ module DefaultColorizer
+ def colorizer
+ @colorizer ||= Colorizers::Default.new(config.theme)
+ end
end
+
+ Logger.include(DefaultColorizer)
end
register_extension(:rouge_colorizer) do
- require_relative './colorizers/rouge'
+ require_relative "./colorizers/rouge"
- def colorizer
- @colorizer ||= Colorizers::Rouge.new(config.theme)
+ module RougeColorizer
+ def colorizer
+ @colorizer ||= Colorizers::Rouge.new(config.theme)
+ end
end
+
+ Logger.include(RougeColorizer)
end
setting :theme, nil
setting :message_template, %( Loaded %s in %sms %s)