Class: ActionMCP::Logging::Logger
- Inherits:
-
Object
- Object
- ActionMCP::Logging::Logger
- Defined in:
- lib/action_mcp/logging/logger.rb
Overview
MCP Logger that sends notifications/message to the MCP client
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Instance Method Summary collapse
-
#alert(message = nil, data: nil) { ... } ⇒ void
Log an alert message.
-
#alert? ⇒ Boolean
Check if alert level is enabled.
-
#critical(message = nil, data: nil) { ... } ⇒ void
Log a critical message.
-
#critical? ⇒ Boolean
Check if critical level is enabled.
-
#debug(message = nil, data: nil) { ... } ⇒ void
Log a debug message.
-
#debug? ⇒ Boolean
Check if debug level is enabled.
-
#emergency(message = nil, data: nil) { ... } ⇒ void
Log an emergency message.
-
#emergency? ⇒ Boolean
Check if emergency level is enabled.
-
#error(message = nil, data: nil) { ... } ⇒ void
Log an error message.
-
#error? ⇒ Boolean
Check if error level is enabled.
-
#info(message = nil, data: nil) { ... } ⇒ void
Log an info message.
-
#info? ⇒ Boolean
Check if info level is enabled.
-
#initialize(name: nil, session:, state:) ⇒ Logger
constructor
Initialize a new MCP logger.
-
#notice(message = nil, data: nil) { ... } ⇒ void
Log a notice message.
-
#notice? ⇒ Boolean
Check if notice level is enabled.
-
#warning(message = nil, data: nil) { ... } ⇒ void
(also: #warn)
Log a warning message.
-
#warning? ⇒ Boolean
(also: #warn?)
Check if warning level is enabled.
Constructor Details
#initialize(name: nil, session:, state:) ⇒ Logger
Initialize a new MCP logger
13 14 15 16 17 |
# File 'lib/action_mcp/logging/logger.rb', line 13 def initialize(name: nil, session:, state:) @name = name @session = session @state = state end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/action_mcp/logging/logger.rb', line 7 def name @name end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
7 8 9 |
# File 'lib/action_mcp/logging/logger.rb', line 7 def session @session end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
7 8 9 |
# File 'lib/action_mcp/logging/logger.rb', line 7 def state @state end |
Instance Method Details
#alert(message = nil, data: nil) { ... } ⇒ void
This method returns an undefined value.
Log an alert message
79 80 81 |
# File 'lib/action_mcp/logging/logger.rb', line 79 def alert( = nil, data: nil, &block) log(:alert, , data: data, &block) end |
#alert? ⇒ Boolean
Check if alert level is enabled
131 132 133 |
# File 'lib/action_mcp/logging/logger.rb', line 131 def alert? state.should_log?(:alert) end |
#critical(message = nil, data: nil) { ... } ⇒ void
This method returns an undefined value.
Log a critical message
70 71 72 |
# File 'lib/action_mcp/logging/logger.rb', line 70 def critical( = nil, data: nil, &block) log(:critical, , data: data, &block) end |
#critical? ⇒ Boolean
Check if critical level is enabled
125 126 127 |
# File 'lib/action_mcp/logging/logger.rb', line 125 def critical? state.should_log?(:critical) end |
#debug(message = nil, data: nil) { ... } ⇒ void
This method returns an undefined value.
Log a debug message
24 25 26 |
# File 'lib/action_mcp/logging/logger.rb', line 24 def debug( = nil, data: nil, &block) log(:debug, , data: data, &block) end |
#debug? ⇒ Boolean
Check if debug level is enabled
94 95 96 |
# File 'lib/action_mcp/logging/logger.rb', line 94 def debug? state.should_log?(:debug) end |
#emergency(message = nil, data: nil) { ... } ⇒ void
This method returns an undefined value.
Log an emergency message
88 89 90 |
# File 'lib/action_mcp/logging/logger.rb', line 88 def emergency( = nil, data: nil, &block) log(:emergency, , data: data, &block) end |
#emergency? ⇒ Boolean
Check if emergency level is enabled
137 138 139 |
# File 'lib/action_mcp/logging/logger.rb', line 137 def emergency? state.should_log?(:emergency) end |
#error(message = nil, data: nil) { ... } ⇒ void
This method returns an undefined value.
Log an error message
61 62 63 |
# File 'lib/action_mcp/logging/logger.rb', line 61 def error( = nil, data: nil, &block) log(:error, , data: data, &block) end |
#error? ⇒ Boolean
Check if error level is enabled
119 120 121 |
# File 'lib/action_mcp/logging/logger.rb', line 119 def error? state.should_log?(:error) end |
#info(message = nil, data: nil) { ... } ⇒ void
This method returns an undefined value.
Log an info message
33 34 35 |
# File 'lib/action_mcp/logging/logger.rb', line 33 def info( = nil, data: nil, &block) log(:info, , data: data, &block) end |
#info? ⇒ Boolean
Check if info level is enabled
100 101 102 |
# File 'lib/action_mcp/logging/logger.rb', line 100 def info? state.should_log?(:info) end |
#notice(message = nil, data: nil) { ... } ⇒ void
This method returns an undefined value.
Log a notice message
42 43 44 |
# File 'lib/action_mcp/logging/logger.rb', line 42 def notice( = nil, data: nil, &block) log(:notice, , data: data, &block) end |
#notice? ⇒ Boolean
Check if notice level is enabled
106 107 108 |
# File 'lib/action_mcp/logging/logger.rb', line 106 def notice? state.should_log?(:notice) end |
#warning(message = nil, data: nil) { ... } ⇒ void Also known as: warn
This method returns an undefined value.
Log a warning message
51 52 53 |
# File 'lib/action_mcp/logging/logger.rb', line 51 def warning( = nil, data: nil, &block) log(:warning, , data: data, &block) end |
#warning? ⇒ Boolean Also known as: warn?
Check if warning level is enabled
112 113 114 |
# File 'lib/action_mcp/logging/logger.rb', line 112 def warning? state.should_log?(:warning) end |