Class: OllamaChat::Utils::ExconLogger
- Inherits:
-
Object
- Object
- OllamaChat::Utils::ExconLogger
- Defined in:
- lib/ollama_chat/utils/excon_logger.rb
Overview
A lightweight Logger adapter that routes Excon log messages through the OllamaChat logging system.
This allows Excon's debug output to be captured and formatted consistently with the rest of the application, avoiding direct writes to $stderr.
Constant Summary collapse
- LOG_METHODS =
Standard Ruby Logger severity methods to intercept
%i[debug info warn error fatal unknown].freeze
Instance Method Summary collapse
-
#<<(_message) ⇒ nil
Stub for Logger#<<(not used by Excon LoggingInstrumentor).
-
#initialize(chat) ⇒ ExconLogger
constructor
Creates a new ExconLogger instance.
-
#method ⇒ NilClass, TrueClass
Dynamically defines all standard logger severity methods to route through the chat's logging system.
Constructor Details
#initialize(chat) ⇒ ExconLogger
Creates a new ExconLogger instance.
17 18 19 |
# File 'lib/ollama_chat/utils/excon_logger.rb', line 17 def initialize(chat) @chat = chat end |
Instance Method Details
#<<(_message) ⇒ nil
Stub for Logger#<<(not used by Excon LoggingInstrumentor).
40 41 42 |
# File 'lib/ollama_chat/utils/excon_logger.rb', line 40 def <<() nil end |
#method ⇒ NilClass, TrueClass
Dynamically defines all standard logger severity methods to route through the chat's logging system.
26 27 28 29 30 31 32 33 34 |
# File 'lib/ollama_chat/utils/excon_logger.rb', line 26 LOG_METHODS.each do |method| define_method(method) do | = nil, &block| msg = block&.() || return unless msg @chat.log(:debug, "Excon", data: { method => msg }) true end end |