Module: LogStruct::BootBuffer

Extended by:
T::Sig
Defined in:
lib/log_struct/boot_buffer.rb

Overview

Collects structured logs during very early boot before the logger is ready.

Constant Summary collapse

@@logs =
T.let([], T::Array[LogStruct::Log::Interfaces::CommonFields])

Class Method Summary collapse

Class Method Details

.add(log) ⇒ void

This method returns an undefined value.



12
13
14
# File 'lib/log_struct/boot_buffer.rb', line 12

def self.add(log)
  @@logs << log
end

.clearvoid

This method returns an undefined value.



24
25
26
# File 'lib/log_struct/boot_buffer.rb', line 24

def self.clear
  @@logs.clear
end

.flushvoid

This method returns an undefined value.



17
18
19
20
21
# File 'lib/log_struct/boot_buffer.rb', line 17

def self.flush
  return if @@logs.empty?
  @@logs.each { |l| LogStruct.info(l) }
  @@logs.clear
end