Module: Sinlog::Refin

Defined in:
lib/sinlog/06_loggable.rb

Overview

Note:

The main difference from Mixin is that Refin uses Refinements instead of Mixins.

  • You need to activate it with using Sinlog::Refin
  • rather than include Sinlog::Mixin

Source

refine ::Object { import_methods LogExt }

Methods

  • #log_dbg – DEBUG
  • #log_info – INFO
  • #log_warn – WARN
  • #log_err – ERROR
  • #log_fatal – FATAL
  • #log_unk – UNKNOWN

Examples:


require 'sinlog'

module A
  module_function
  using Sinlog::Refin

  def demo = "Something happened".log_warn
  def respon_to_log_dbg? = [].respond_to? :log_dbg
end

A.demo
  # => [WARN] 11:17:38.024 Something happened
  # // (WARN is displayed in yellow highlight; 11:17:38.024 is the current time and may vary)

A.respon_to_log_dbg?  # => true
[].respond_to? :log_dbg #=> false

See Also: