Class: FastMcp::Logger
- Inherits:
-
Logger
- Object
- Logger
- FastMcp::Logger
- Defined in:
- lib/mcp/logger.rb
Instance Attribute Summary collapse
-
#client_initialized ⇒ Object
(also: #client_initialized?)
Returns the value of attribute client_initialized.
-
#transport ⇒ Object
Returns the value of attribute transport.
Instance Method Summary collapse
- #add(severity, message = nil, progname = nil, &block) ⇒ Object
-
#initialize(transport: :stdio) ⇒ Logger
constructor
A new instance of Logger.
- #rack_transport? ⇒ Boolean
- #stdio_transport? ⇒ Boolean
Constructor Details
#initialize(transport: :stdio) ⇒ Logger
Returns a new instance of Logger.
6 7 8 9 10 11 12 |
# File 'lib/mcp/logger.rb', line 6 def initialize(transport: :stdio) @client_initialized = false @transport = transport # we don't want to log to stdout if we're using the stdio transport super($stdout) unless stdio_transport? end |
Instance Attribute Details
#client_initialized ⇒ Object Also known as: client_initialized?
Returns the value of attribute client_initialized.
14 15 16 |
# File 'lib/mcp/logger.rb', line 14 def client_initialized @client_initialized end |
#transport ⇒ Object
Returns the value of attribute transport.
14 15 16 |
# File 'lib/mcp/logger.rb', line 14 def transport @transport end |
Instance Method Details
#add(severity, message = nil, progname = nil, &block) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/mcp/logger.rb', line 21 def add(severity, = nil, progname = nil, &block) return if stdio_transport? # we don't want to log to stdout if we're using the stdio transport # TODO: implement logging as the specification requires super end |
#rack_transport? ⇒ Boolean
28 29 30 |
# File 'lib/mcp/logger.rb', line 28 def rack_transport? transport == :rack end |
#stdio_transport? ⇒ Boolean
17 18 19 |
# File 'lib/mcp/logger.rb', line 17 def stdio_transport? transport == :stdio end |