Class: Aws::Embedded::Metrics::Sinks::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/aws-embedded-metrics-customink/sinks/logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(logger, level: :info) ⇒ Logger

Returns a new instance of Logger.



9
10
11
12
# File 'lib/aws-embedded-metrics-customink/sinks/logger.rb', line 9

def initialize(logger, level: :info)
  @logger = logger
  @level = level.to_sym
end

Instance Attribute Details

#levelObject (readonly)

Returns the value of attribute level.



7
8
9
# File 'lib/aws-embedded-metrics-customink/sinks/logger.rb', line 7

def level
  @level
end

#loggerObject (readonly)

Returns the value of attribute logger.



7
8
9
# File 'lib/aws-embedded-metrics-customink/sinks/logger.rb', line 7

def logger
  @logger
end

Instance Method Details

#accept(message) ⇒ Object



14
15
16
# File 'lib/aws-embedded-metrics-customink/sinks/logger.rb', line 14

def accept(message)
  logger.public_send(level, JSON.dump(message))
end