Class: MCP::LoggingMessageNotification

Inherits:
Object
  • Object
show all
Defined in:
lib/mcp/logging_message_notification.rb

Constant Summary collapse

LOG_LEVEL_SEVERITY =
{
  "debug" => 0,
  "info" => 1,
  "notice" => 2,
  "warning" => 3,
  "error" => 4,
  "critical" => 5,
  "alert" => 6,
  "emergency" => 7,
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(level:) ⇒ LoggingMessageNotification

Returns a new instance of LoggingMessageNotification.



16
17
18
# File 'lib/mcp/logging_message_notification.rb', line 16

def initialize(level:)
  @level = level
end

Instance Method Details

#should_notify?(log_level) ⇒ Boolean

Returns:



24
25
26
27
28
# File 'lib/mcp/logging_message_notification.rb', line 24

def should_notify?(log_level)
  return false unless LOG_LEVEL_SEVERITY.key?(log_level)

  LOG_LEVEL_SEVERITY[log_level] >= LOG_LEVEL_SEVERITY[@level]
end

#valid_level?Boolean

Returns:



20
21
22
# File 'lib/mcp/logging_message_notification.rb', line 20

def valid_level?
  LOG_LEVEL_SEVERITY.keys.include?(@level)
end