Module: Assemblr::Log
- Defined in:
- lib/assemblr.rb
Overview
Define some quick-and-easy logging methods.
Constant Summary collapse
- TTYLogger =
TTY::Logger.new do |config| config. = %i[time date] end
Class Method Summary collapse
-
.error(message) ⇒ void
Logs a error message.
- .included(_) ⇒ Object
-
.info(message) ⇒ void
Logs an info message.
-
.success(message) ⇒ void
Logs a success message.
-
.warn(message) ⇒ void
Logs a warning message.
Class Method Details
.error(message) ⇒ void
This method returns an undefined value.
Logs a error message. If configured, this will call the on_error proc
98 99 100 101 |
# File 'lib/assemblr.rb', line 98 define_method :error do |*args, &block| TTYLogger.send(:error, *args, &block) if get_option(:log) error_hook.call if get_option(:log_error_hook) end |
.included(_) ⇒ Object
62 63 64 65 66 67 |
# File 'lib/assemblr.rb', line 62 def self.included(_) expose_method :info expose_method :success expose_method :warn expose_method :error end |
.info(message) ⇒ void
This method returns an undefined value.
Logs an info message.
|
# File 'lib/assemblr.rb', line 70
|
.success(message) ⇒ void
This method returns an undefined value.
Logs a success message.
|
# File 'lib/assemblr.rb', line 76
|
.warn(message) ⇒ void
This method returns an undefined value.
Logs a warning message.
87 88 89 90 91 |
# File 'lib/assemblr.rb', line 87 %i[info success warn].each do |level| define_method level do |*args, &block| TTYLogger.send(level, *args, &block) if get_option(:log) end end |