Class: Appsignal::Utils::IntegrationMemoryLogger Private
- Defined in:
- lib/appsignal/utils/integration_memory_logger.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- LEVELS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ Logger::DEBUG => :DEBUG, Logger::INFO => :INFO, Logger::WARN => :WARN, Logger::ERROR => :ERROR, Logger::FATAL => :FATAL, Logger::UNKNOWN => :UNKNOWN }.freeze
Instance Attribute Summary collapse
- #formatter ⇒ Object private
- #level ⇒ Object private
Instance Method Summary collapse
- #add(severity, message, _progname = nil) ⇒ Object (also: #log) private
- #clear ⇒ Object private
- #debug(message) ⇒ Object private
- #error(message) ⇒ Object private
- #fatal(message) ⇒ Object private
- #info(message) ⇒ Object private
- #messages ⇒ Object private
- #messages_for_level(level) ⇒ Object private
- #unknown(message) ⇒ Object private
- #warn(message) ⇒ Object private
Instance Attribute Details
#formatter ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 |
# File 'lib/appsignal/utils/integration_memory_logger.rb', line 17 def formatter @formatter end |
#level ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 |
# File 'lib/appsignal/utils/integration_memory_logger.rb', line 17 def level @level end |
Instance Method Details
#add(severity, message, _progname = nil) ⇒ Object Also known as: log
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 22 |
# File 'lib/appsignal/utils/integration_memory_logger.rb', line 19 def add(severity, , _progname = nil) = formatter.call(severity, Time.now, nil, ) if formatter [severity] << end |
#clear ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
49 50 51 |
# File 'lib/appsignal/utils/integration_memory_logger.rb', line 49 def clear .clear end |
#debug(message) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
25 26 27 |
# File 'lib/appsignal/utils/integration_memory_logger.rb', line 25 def debug() add(:DEBUG, ) end |
#error(message) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 |
# File 'lib/appsignal/utils/integration_memory_logger.rb', line 37 def error() add(:ERROR, ) end |
#fatal(message) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
41 42 43 |
# File 'lib/appsignal/utils/integration_memory_logger.rb', line 41 def fatal() add(:FATAL, ) end |
#info(message) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
29 30 31 |
# File 'lib/appsignal/utils/integration_memory_logger.rb', line 29 def info() add(:INFO, ) end |
#messages ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
53 54 55 |
# File 'lib/appsignal/utils/integration_memory_logger.rb', line 53 def @messages ||= Hash.new { |hash, key| hash[key] = [] } end |
#messages_for_level(level) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
57 58 59 60 61 62 |
# File 'lib/appsignal/utils/integration_memory_logger.rb', line 57 def (level) levels = LEVELS.select { |log_level| log_level >= level }.values .select { |log_level| levels.include?(log_level) } .flat_map { |_level, | } end |
#unknown(message) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
45 46 47 |
# File 'lib/appsignal/utils/integration_memory_logger.rb', line 45 def unknown() add(:UNKNOWN, ) end |
#warn(message) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
33 34 35 |
# File 'lib/appsignal/utils/integration_memory_logger.rb', line 33 def warn() add(:WARN, ) end |