Class: MongoBeautifulLogger

Inherits:
Object
  • Object
show all
Includes:
Colors, MongoActions
Defined in:
lib/mongo_beautiful_logger.rb

Constant Summary

Constants included from Colors

Colors::BLACK, Colors::BLUE, Colors::BOLD, Colors::CLEAR, Colors::CYAN, Colors::GREEN, Colors::MAGENTA, Colors::RED, Colors::WHITE, Colors::YELLOW

Constants included from MongoActions

MongoActions::ACTIONS, MongoActions::AGGREGATE, MongoActions::DELETE, MongoActions::ENDSESSION, MongoActions::ERROR, MongoActions::FAILED, MongoActions::FIND, MongoActions::INITIALIZING, MongoActions::INSERT, MongoActions::PREFIX_REGEX, MongoActions::SUCCEEDED, MongoActions::UNNECESSARY, MongoActions::UPDATE

Instance Method Summary collapse

Constructor Details

#initialize(*targets) ⇒ MongoBeautifulLogger

Returns a new instance of MongoBeautifulLogger.



9
10
11
12
13
14
15
16
# File 'lib/mongo_beautiful_logger.rb', line 9

def initialize(*targets)
  nil_targets_error if targets.empty?
  @targets = targets.map do |t| 
    logger = Logger.new(t)
    format! logger
    logger
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object (private)

send all other methods back to logger instance



66
67
68
# File 'lib/mongo_beautiful_logger.rb', line 66

def method_missing(method, *args, &block)
  @targets.each { |t| t.send(method, *args, &block) }
end