Module: CloudWatchLogger

Defined in:
lib/cloudwatchlogger.rb,
lib/cloudwatchlogger/client.rb,
lib/cloudwatchlogger/version.rb,
lib/cloudwatchlogger/client/aws_sdk.rb,
lib/cloudwatchlogger/client/aws_sdk/threaded.rb

Defined Under Namespace

Modules: Client Classes: LogEventRejected, LogGroupNameRequired

Constant Summary collapse

VERSION =
'0.4.0'.freeze

Class Method Summary collapse

Class Method Details

.new(credentials, log_group_name, log_stream_name = nil, opts = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/cloudwatchlogger.rb', line 9

def self.new(credentials, log_group_name, log_stream_name = nil, opts = {})
  client = CloudWatchLogger::Client.new(credentials, log_group_name, log_stream_name, opts)
  logger = Logger.new(client)

  if client.respond_to?(:formatter)
    logger.formatter = client.formatter(opts[:format])
  elsif client.respond_to?(:datetime_format)
    logger.datetime_format = client.datetime_format
  end

  logger
end