Class: RbSys::Util::Logger
- Inherits:
-
Object
- Object
- RbSys::Util::Logger
- Defined in:
- lib/rb_sys/util/logger.rb
Instance Attribute Summary collapse
-
#io ⇒ Object
Returns the value of attribute io.
-
#level ⇒ Object
Returns the value of attribute level.
Instance Method Summary collapse
- #error(message, **opts) ⇒ Object
- #fatal(message, **opts) ⇒ Object
- #info(message, **opts) ⇒ Object
-
#initialize(io: $stderr, level: :info) ⇒ Logger
constructor
A new instance of Logger.
- #notice(message, **opts) ⇒ Object
- #trace(message, **opts) ⇒ Object
- #warn(message, **opts) ⇒ Object
Constructor Details
#initialize(io: $stderr, level: :info) ⇒ Logger
Returns a new instance of Logger.
8 9 10 11 |
# File 'lib/rb_sys/util/logger.rb', line 8 def initialize(io: $stderr, level: :info) @io = ENV["GITHUB_ACTIONS"] ? $stdout : io @level = level end |
Instance Attribute Details
#io ⇒ Object
Returns the value of attribute io.
6 7 8 |
# File 'lib/rb_sys/util/logger.rb', line 6 def io @io end |
#level ⇒ Object
Returns the value of attribute level.
6 7 8 |
# File 'lib/rb_sys/util/logger.rb', line 6 def level @level end |
Instance Method Details
#error(message, **opts) ⇒ Object
13 14 15 |
# File 'lib/rb_sys/util/logger.rb', line 13 def error(, **opts) add(:error, , **opts) end |
#fatal(message, **opts) ⇒ Object
35 36 37 38 |
# File 'lib/rb_sys/util/logger.rb', line 35 def fatal(, **opts) error(, **opts) abort end |
#info(message, **opts) ⇒ Object
21 22 23 |
# File 'lib/rb_sys/util/logger.rb', line 21 def info(, **opts) add(:info, , **opts) end |
#notice(message, **opts) ⇒ Object
25 26 27 |
# File 'lib/rb_sys/util/logger.rb', line 25 def notice(, **opts) add(:notice, , **opts) end |
#trace(message, **opts) ⇒ Object
29 30 31 32 33 |
# File 'lib/rb_sys/util/logger.rb', line 29 def trace(, **opts) return unless level == :trace add(:trace, , **opts) end |
#warn(message, **opts) ⇒ Object
17 18 19 |
# File 'lib/rb_sys/util/logger.rb', line 17 def warn(, **opts) add(:warn, , **opts) end |