class NoirLogger

Defined in:

models/logger.cr

Constant Summary

SHIMMER_BAND_RADIUS = SHIMMER_COLORS.size - 1
SHIMMER_COLORS = [159, 255, 250, 247, 245]
SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]
SPINNER_INTERVAL = 60.milliseconds

Frame delay. sleep (fiber-aware) rather than LibC.usleep, which would block the whole scheduler now that the spinner is a fiber.

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(debug : Bool, verbose : Bool, colorize : Bool, no_log : Bool, no_spinner : Bool = false) #

[View source]

Class Method Detail

def self.broken_pipe?(ex : IO::Error) : Bool #

IO::Error#os_error is Errno | WinError | WasiError | Nil — on Windows a broken pipe surfaces as a WinError, not an Errno, so comparing straight against Errno::EPIPE silently never matches there. WinError#to_errno normalizes it (ERROR_BROKEN_PIPE / ERROR_NO_DATA both map to Errno::EPIPE). Noir doesn't ship a WASI build, so WasiError — whose own #to_errno doesn't even compile on every native target (it references an Errno member some platforms' bindings omit) — is intentionally left out of this check.


[View source]

Instance Method Detail

def debug(message) #

[View source]
def debug(&) : Nil #

Block form for messages that cost something to build. The message overload takes an already-built String, so debug "...#{expensive}" pays for the interpolation on every call and then throws it away with debug off; debug { "...#{expensive}" } doesn't build it at all.


[View source]
def debug_sub(message) #

[View source]
def error(message) #

[View source]
def fatal(message) #

[View source]
def heading(message) #

[View source]
def info(message) #

[View source]
def loading(message : String, &) #

[View source]
def log(level : LogLevel, message : String) #

[View source]
def puts(message) #

[View source]
def puts_sub(message) #

[View source]
def sub(message) #

[View source]
def success(message) #

[View source]
def verbose(message) #

[View source]
def verbose_sub(message) #

[View source]
def warning(message) #

[View source]