Module: Roast::Log
Overview
Central logging interface for Roast.
Provides a simple, testable logging API that wraps the standard library Logger and leverages Roast’s Event framework for clean async task integration with proper task hierarchy attribution. Outputs to STDERR by default.
Defined Under Namespace
Classes: Message
Constant Summary collapse
- LOG_LEVELS =
{ DEBUG: ::Logger::DEBUG, INFO: ::Logger::INFO, WARN: ::Logger::WARN, ERROR: ::Logger::ERROR, FATAL: ::Logger::FATAL, }.freeze
Instance Attribute Summary collapse
-
#logger ⇒ Object
: () -> Logger.
Instance Method Summary collapse
-
#debug(message) ⇒ Object
: (String) -> void.
-
#error(message) ⇒ Object
: (String) -> void.
-
#fatal(message) ⇒ Object
: (String) -> void.
-
#info(message) ⇒ Object
: (String) -> void.
-
#reset! ⇒ Object
: () -> void.
-
#tty? ⇒ Boolean
: () -> bool.
-
#unknown(message) ⇒ Object
: (String) -> void.
-
#warn(message) ⇒ Object
: (String) -> void.
Instance Attribute Details
#logger ⇒ Object
: () -> Logger
86 87 88 |
# File 'lib/roast/log.rb', line 86 def logger @logger ||= create_logger end |
Instance Method Details
#debug(message) ⇒ Object
: (String) -> void
56 57 58 |
# File 'lib/roast/log.rb', line 56 def debug() Roast::Event << { debug: } end |
#error(message) ⇒ Object
: (String) -> void
71 72 73 |
# File 'lib/roast/log.rb', line 71 def error() Roast::Event << { error: } end |
#fatal(message) ⇒ Object
: (String) -> void
76 77 78 |
# File 'lib/roast/log.rb', line 76 def fatal() Roast::Event << { fatal: } end |
#info(message) ⇒ Object
: (String) -> void
61 62 63 |
# File 'lib/roast/log.rb', line 61 def info() Roast::Event << { info: } end |
#reset! ⇒ Object
: () -> void
91 92 93 |
# File 'lib/roast/log.rb', line 91 def reset! @logger = nil end |
#tty? ⇒ Boolean
: () -> bool
96 97 98 99 100 101 |
# File 'lib/roast/log.rb', line 96 def tty? return false unless @logger logdev = @logger.instance_variable_get(:@logdev)&.dev logdev&.respond_to?(:isatty) && logdev&.isatty end |