Class: MyStuff::Logger::ReaderFilters::MultiDBUnmangle
- Inherits:
-
MyStuff::Logger::ReaderFilter
- Object
- MyStuff::Logger::ReaderFilter
- MyStuff::Logger::ReaderFilters::MultiDBUnmangle
- Defined in:
- lib/my_stuff/logger/reader_filters/multidb_unmangle.rb
Overview
For use with MyStuff::MultiDB.
Your backtrace will include something like:
Foo::MYSTUFF_MULTIDB_DB_load_of_hex::Bar
And give you:
Foo::<host:port/database>::Bar
Instance Method Summary collapse
Methods inherited from MyStuff::Logger::ReaderFilter
Instance Method Details
#filter_line(line, options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/my_stuff/logger/reader_filters/multidb_unmangle.rb', line 13 def filter_line line, = {} line.gsub(/MYSTUFF_MULTIDB_DB_[a-z0-9]+/) do |mangled| data = MyStuff::MultiDB.unmangle(mangled) unmangled = "<%s:%d/%s>" % [ data[:host], data[:port], data[:database], ] if [:colorize] # Make it cyan "\e[36m%s\e[0m" % unmangled else unmangled end end end |