Module: LoggerClassMethods
- Included in:
- Motion::Log
- Defined in:
- lib/logger/log.rb
Constant Summary collapse
- FLAGS =
{ :error => (1<<0), # 0...0001 :warn => (1<<1), # 0...0010 :info => (1<<2), # 0...0100 :verbose => (1<<3), # 0...1000 :debug => (1<<3) # 0...1000 }
- LEVELS =
{ :off => 0, :error => FLAGS[:error], :warn => FLAGS[:error] | FLAGS[:warn], :info => FLAGS[:error] | FLAGS[:warn] | FLAGS[:info], :verbose => FLAGS[:error] | FLAGS[:warn] | FLAGS[:info] | FLAGS[:verbose], :debug => FLAGS[:error] | FLAGS[:warn] | FLAGS[:info] | FLAGS[:verbose] }
Instance Method Summary collapse
- #async ⇒ Object
- #async=(async) ⇒ Object
- #debug(message) ⇒ Object (also: #verbose)
- #error(message) ⇒ Object
- #info(message) ⇒ Object
- #level ⇒ Object
- #level=(level) ⇒ Object
- #logging?(flag) ⇒ Boolean
- #warn(message) ⇒ Object
Instance Method Details
#async ⇒ Object
31 32 33 |
# File 'lib/logger/log.rb', line 31 def async @async end |
#async=(async) ⇒ Object
27 28 29 |
# File 'lib/logger/log.rb', line 27 def async=(async) @async = async end |
#debug(message) ⇒ Object Also known as: verbose
47 48 49 |
# File 'lib/logger/log.rb', line 47 def debug() __log(:verbose, ) end |
#error(message) ⇒ Object
35 36 37 |
# File 'lib/logger/log.rb', line 35 def error() __log(:error, ) end |
#info(message) ⇒ Object
43 44 45 |
# File 'lib/logger/log.rb', line 43 def info() __log(:info, ) end |
#level ⇒ Object
23 24 25 |
# File 'lib/logger/log.rb', line 23 def level @level end |
#level=(level) ⇒ Object
19 20 21 |
# File 'lib/logger/log.rb', line 19 def level=(level) @level = level end |
#logging?(flag) ⇒ Boolean
52 53 54 |
# File 'lib/logger/log.rb', line 52 def logging?(flag) (LEVELS[level] & FLAGS[flag]) > 0 end |
#warn(message) ⇒ Object
39 40 41 |
# File 'lib/logger/log.rb', line 39 def warn() __log(:warn, ) end |