Module: S3Logger

Defined in:
lib/s3_logger.rb,
lib/s3_logger/version.rb

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.log(message, timestamp_flag = false, file = ENV['S3_LOGGER_FILE'], path = ENV['S3_LOGGER_PATH']) ⇒ Object



4
5
6
7
8
9
# File 'lib/s3_logger.rb', line 4

def self.log(message, timestamp_flag=false, file=ENV['S3_LOGGER_FILE'], path=ENV['S3_LOGGER_PATH'])
  message += "\n"
  message = "[#{Time.now}]\n" + message if timestamp_flag
  full_path = path + file
  EasyS3.exists?(full_path) ? EasyS3.append(full_path, message) : EasyS3.write(full_path, message)
end