Module: Gorgon::GLogger

Included in:
Listener, OriginatorLogger, Worker, WorkerManager
Defined in:
lib/gorgon/g_logger.rb

Constant Summary collapse

SIZE_1_MB =
1048576

Instance Method Summary collapse

Instance Method Details

#initialize_logger(log_file) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/gorgon/g_logger.rb', line 7

def initialize_logger log_file
  return unless log_file
  @logger =
    if log_file == "-"
      Logger.new($stdout)
    else
      Logger.new(log_file, 1, SIZE_1_MB)
    end
  @logger.datetime_format = "%Y-%m-%d %H:%M:%S "
end

#log(text) ⇒ Object



18
19
20
# File 'lib/gorgon/g_logger.rb', line 18

def log text
  @logger.info(text) if @logger
end

#log_error(text) ⇒ Object



22
23
24
# File 'lib/gorgon/g_logger.rb', line 22

def log_error text
  @logger.error(text) if @logger
end