Class: MockEM::LoggerWithPrefix

Inherits:
Object
  • Object
show all
Defined in:
lib/mock_em/logger_with_prefix.rb

Overview

Logs all messages with the specified prefix. Warning: this is a not a full-fledged Logger implementation, it just logs string messages.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prefix, logger) ⇒ LoggerWithPrefix

Returns a new instance of LoggerWithPrefix.



10
11
12
13
# File 'lib/mock_em/logger_with_prefix.rb', line 10

def initialize(prefix, logger)
  @prefix     = prefix
  @raw_logger = logger
end

Instance Attribute Details

#prefixObject (readonly)

Returns the value of attribute prefix.



7
8
9
# File 'lib/mock_em/logger_with_prefix.rb', line 7

def prefix
  @prefix
end

#raw_loggerObject (readonly)

Returns the value of attribute raw_logger.



8
9
10
# File 'lib/mock_em/logger_with_prefix.rb', line 8

def raw_logger
  @raw_logger
end

Instance Method Details

#debug(msg) ⇒ Object



15
# File 'lib/mock_em/logger_with_prefix.rb', line 15

def debug(msg); log_with_prefix(:debug, msg)  end

#error(msg) ⇒ Object



18
# File 'lib/mock_em/logger_with_prefix.rb', line 18

def error(msg); log_with_prefix(:error, msg)  end

#info(msg) ⇒ Object



16
# File 'lib/mock_em/logger_with_prefix.rb', line 16

def info(msg);  log_with_prefix(:info,  msg)  end

#warn(msg) ⇒ Object



17
# File 'lib/mock_em/logger_with_prefix.rb', line 17

def warn(msg);  log_with_prefix(:warn,  msg)  end