Class: Rox::Server::ServerLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/rox/server/logging/server_logger.rb

Instance Method Summary collapse

Constructor Details

#initializeServerLogger

Returns a new instance of ServerLogger.



6
7
8
# File 'lib/rox/server/logging/server_logger.rb', line 6

def initialize
  @logger = Logger.new($stdout)
end

Instance Method Details

#debug(message, ex = nil) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/rox/server/logging/server_logger.rb', line 10

def debug(message, ex = nil)
  if ex.nil?
    @logger.debug(message)
  else
    @logger.debug("#{message}. Exception: #{ex}")
  end
end

#error(message, ex = nil) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/rox/server/logging/server_logger.rb', line 18

def error(message, ex = nil)
  if ex.nil?
    @logger.error(message)
  else
    @logger.error("#{message}. Exception: #{ex}")
  end
end

#warn(message, ex = nil) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/rox/server/logging/server_logger.rb', line 26

def warn(message, ex = nil)
  if ex.nil?
    @logger.warn(message)
  else
    @logger.warn("#{message}. Exception: #{ex}")
  end
end