Class: Snails::Logger::Formatter
- Defined in:
- runtime/snails/logger/formatter.rbs,
runtime/snails/logger/formatter.rb
Constant Summary collapse
- FRACTION_ZEROS =
Zero padding for the fractional second, indexed by digit count.
[ "000000", "00000", "0000", "000", "00", "0", "" ].freeze
Class Method Summary collapse
-
.format_time(time) ⇒ String
the timestamp rule both local log lines share: the app's zone wall clock with microseconds, plus the zone offset (
Zfor UTC), so a line read in another zone still names the same instant. -
.fraction_text(usec) ⇒ Object
the six-digit fractional second
%6Nrenders, from the microsecond the Time already holds:usec.to_sis far cheaper than the strftime pass that would produce the same digits.
Instance Method Summary collapse
Class Method Details
.format_time(time) ⇒ String
the timestamp rule both local log lines share: the app's zone wall clock
with microseconds, plus the zone offset (Z for UTC), so a line read in
another zone still names the same instant. The record line calls this
too, so an app string call and a framework event spell an instant alike.
The calendar fields hold for a whole second, and strftime on a local
time serializes across request threads in this runtime (measured: its
call rate stays flat from one thread to 32), so the date, clock, and
zone text are rendered once per second and reused. Only the fractional
second is per call.
38 |
# File 'runtime/snails/logger/formatter.rb', line 38
def self.format_time: (Time time) -> String
|
.fraction_text(usec) ⇒ Object
the six-digit fractional second %6N renders, from the microsecond
the Time already holds: usec.to_s is far cheaper than the strftime
pass that would produce the same digits.
57 |
# File 'runtime/snails/logger/formatter.rb', line 57
def self.fraction_text: (Integer usec) -> String
|
Instance Method Details
#call(severity, time, progname, message) ⇒ String
7 |
# File 'runtime/snails/logger/formatter.rbs', line 7
def call: (untyped severity, ::Time time, untyped progname, untyped message) -> String
|