Module: LogStruct::Integrations::Puma::LogWriterPatch
- Extended by:
- T::Sig
- Defined in:
- lib/log_struct/integrations/puma.rb
Overview
Patch Puma::LogWriter to intercept log writes
Instance Method Summary collapse
- #<<(msg) ⇒ T.untyped
- #info(msg) ⇒ T.untyped
- #log(msg) ⇒ T.untyped
- #puts(msg) ⇒ T.untyped
- #write(msg) ⇒ T.untyped
Instance Method Details
#<<(msg) ⇒ T.untyped
352 353 354 355 356 357 358 |
# File 'lib/log_struct/integrations/puma.rb', line 352 def <<(msg) any_consumed = T.let(false, T::Boolean) msg.to_s.each_line do |l| any_consumed = true if ::LogStruct::Integrations::Puma.process_line(l) end super unless any_consumed end |
#info(msg) ⇒ T.untyped
375 376 377 378 |
# File 'lib/log_struct/integrations/puma.rb', line 375 def info(msg) consumed = ::LogStruct::Integrations::Puma.process_line(msg) super unless consumed end |
#log(msg) ⇒ T.untyped
337 338 339 340 |
# File 'lib/log_struct/integrations/puma.rb', line 337 def log(msg) consumed = ::LogStruct::Integrations::Puma.process_line(msg) super unless consumed end |
#puts(msg) ⇒ T.untyped
361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/log_struct/integrations/puma.rb', line 361 def puts(msg) consumed = ::LogStruct::Integrations::Puma.process_line(msg) if consumed # attempt to suppress; only forward if not consumed return nil end if ::Kernel.instance_variables.include?(:@stdout) io = T.unsafe(::Kernel.instance_variable_get(:@stdout)) return io.puts(msg) end super end |
#write(msg) ⇒ T.untyped
343 344 345 346 347 348 349 |
# File 'lib/log_struct/integrations/puma.rb', line 343 def write(msg) any_consumed = T.let(false, T::Boolean) msg.to_s.each_line do |l| any_consumed = true if ::LogStruct::Integrations::Puma.process_line(l) end super unless any_consumed end |