Class: Orchestra::Logger Deprecated

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/orchestra/logger.rb

Overview

Deprecated.

in favor of Ruby’s Logger

Constant Summary collapse

LOG_FILE_PATH =
"/var/log/orchestra.log"
TIMESTAMP_FORMAT =
"%Y%m%dT%H%M%SZ"

Instance Method Summary collapse

Constructor Details

#initializeLogger

Returns a new instance of Logger.



10
11
12
# File 'lib/orchestra/logger.rb', line 10

def initialize
  @log_file = File.open(LOG_FILE_PATH, "a")
end

Instance Method Details

#close_log_fileObject



26
27
28
# File 'lib/orchestra/logger.rb', line 26

def close_log_file
  @log_file.close
end

#log(text) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/orchestra/logger.rb', line 14

def log(text)
  timestamp = Time.now.strftime(TIMESTAMP_FORMAT)
  log_message = "#{timestamp} #{text}"

  # Append to the log file
  @log_file.puts(log_message)
  @log_file.flush

  # Print to stdout
  puts log_message
end