Sha256: 60d6f14f286ce2c5a4a2a5e81b9d0ff161a5846aa70506e62af9d1aeb3ea6332

Contents?: true

Size: 453 Bytes

Versions: 7

Compression:

Stored size: 453 Bytes

Contents

module Tako
  module ActiveRecordExt
    module LogSubscriber
      CLEAR   = "\e[0m"
      GREEN   = "\e[32m"

      def debug(msg)
        current_shard = ::Tako::ProxyStack.top.try(:shard_name)

        if current_shard
          super("#{GREEN}[Shard: #{current_shard}]#{CLEAR}" + msg)
        else
          super
        end
      end
    end
  end
end

ActiveRecord::LogSubscriber.class_eval do
  prepend Tako::ActiveRecordExt::LogSubscriber
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tako-0.6.0 lib/tako/active_record_ext/log_subscriber.rb
tako-0.5.0 lib/tako/active_record_ext/log_subscriber.rb
tako-0.4.1 lib/tako/active_record_ext/log_subscriber.rb
tako-0.4.0 lib/tako/active_record_ext/log_subscriber.rb
tako-0.3.2 lib/tako/active_record_ext/log_subscriber.rb
tako-0.3.1 lib/tako/active_record_ext/log_subscriber.rb
tako-0.3.0 lib/tako/active_record_ext/log_subscriber.rb