Class: DIY::Logger
- Inherits:
-
Object
- Object
- DIY::Logger
- Defined in:
- lib/diy/logger.rb
Constant Summary collapse
- @@logger_container =
[]
- @@logger =
::Logger.new(STDOUT)
Class Method Summary collapse
- .add(logger) ⇒ Object (also: <<)
- .clear ⇒ Object
- .clear_and_add(logger) ⇒ Object
- .debug(*arg) ⇒ Object
- .error(*arg) ⇒ Object
- .info(*arg) ⇒ Object
- .level=(level) ⇒ Object
- .set(logger) ⇒ Object
- .warn(*arg) ⇒ Object
Class Method Details
.add(logger) ⇒ Object Also known as: <<
46 47 48 |
# File 'lib/diy/logger.rb', line 46 def add(logger) @@logger_container << logger end |
.clear ⇒ Object
51 52 53 |
# File 'lib/diy/logger.rb', line 51 def clear @@logger_container.clear end |
.clear_and_add(logger) ⇒ Object
55 56 57 58 |
# File 'lib/diy/logger.rb', line 55 def clear_and_add(logger) clear add(logger) end |
.debug(*arg) ⇒ Object
11 12 13 14 15 |
# File 'lib/diy/logger.rb', line 11 def debug(*arg) @@logger_container.each do |logger| logger.debug(*arg) end end |
.error(*arg) ⇒ Object
29 30 31 32 33 |
# File 'lib/diy/logger.rb', line 29 def error(*arg) @@logger_container.each do |logger| logger.error(*arg) end end |
.info(*arg) ⇒ Object
17 18 19 20 21 |
# File 'lib/diy/logger.rb', line 17 def info(*arg) @@logger_container.each do |logger| logger.info(*arg) end end |
.level=(level) ⇒ Object
40 41 42 43 44 |
# File 'lib/diy/logger.rb', line 40 def level=(level) @@logger_container.each do |logger| logger.level = level end end |
.set(logger) ⇒ Object
35 36 37 38 |
# File 'lib/diy/logger.rb', line 35 def set(logger) @@logger = logger clear_and_add(logger) end |
.warn(*arg) ⇒ Object
23 24 25 26 27 |
# File 'lib/diy/logger.rb', line 23 def warn(*arg) @@logger_container.each do |logger| logger.warn(*arg) end end |