Module: DbSwitch::LogSubscriber
- Includes:
- ThreadVariables
- Defined in:
- lib/db-switch/log_subscriber.rb
Instance Attribute Summary collapse
-
#color_value ⇒ Object
Returns the value of attribute color_value.
Instance Method Summary collapse
Methods included from ThreadVariables
#db_switch_connection_name, #db_switch_connection_name=
Instance Attribute Details
#color_value ⇒ Object
Returns the value of attribute color_value.
5 6 7 |
# File 'lib/db-switch/log_subscriber.rb', line 5 def color_value @color_value end |
Instance Method Details
#colorize_payload_name(name, payload_name) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/db-switch/log_subscriber.rb', line 7 def colorize_payload_name(name, payload_name) if db_switch_connection_name self.color_value = if payload_name.blank? || payload_name == 'SQL' :MAGENTA else :CYAN end end super end |
#debug(msg) ⇒ Object
19 20 21 22 |
# File 'lib/db-switch/log_subscriber.rb', line 19 def debug(msg) msg = color("[#{db_switch_connection_name}]", color_value || :CYAN, true) + msg if db_switch_connection_name super(msg) end |