Class: EventMachine::RTMP::Logger
- Inherits:
-
Object
- Object
- EventMachine::RTMP::Logger
- Defined in:
- lib/em-rtmp/logger.rb
Constant Summary collapse
- LEVEL_DEBUG =
0
- LEVEL_INFO =
1
- LEVEL_ERROR =
2
- @@level =
LEVEL_INFO
Class Attribute Summary collapse
-
.level(level) ⇒ Object
Returns the value of attribute level.
Class Method Summary collapse
- .debug(message, options = {}) ⇒ Object
- .error(message, options = {}) ⇒ Object
- .info(message, options = {}) ⇒ Object
- .print(message, options = {}) ⇒ Object
Class Attribute Details
.level(level) ⇒ Object
Returns the value of attribute level.
12 13 14 |
# File 'lib/em-rtmp/logger.rb', line 12 def level @level end |
Class Method Details
.debug(message, options = {}) ⇒ Object
19 20 21 22 |
# File 'lib/em-rtmp/logger.rb', line 19 def self.debug(, ={}) return unless @@level <= LEVEL_DEBUG print , {level: "DEBUG", caller: caller}.merge() end |
.error(message, options = {}) ⇒ Object
29 30 31 32 |
# File 'lib/em-rtmp/logger.rb', line 29 def self.error(, ={}) return unless @@level <= LEVEL_ERROR print , {level: "ERROR", caller: caller}.merge() end |
.info(message, options = {}) ⇒ Object
24 25 26 27 |
# File 'lib/em-rtmp/logger.rb', line 24 def self.info(, ={}) return unless @@level <= LEVEL_INFO print , {level: "INFO", caller: caller}.merge() end |
.print(message, options = {}) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/em-rtmp/logger.rb', line 34 def self.print(, ={}) [:level] ||= "PRINT" [:caller] ||= caller caller_splat = [:caller][0].split(":") ruby_file = caller_splat[0].split("/").last ruby_line = caller_splat[1] ruby_method = caller_splat[2].match(/`(.*)'/)[1] puts "%-10s%-30s%-30s%s" % ["[#{[:level]}]", "#{ruby_file}:#{ruby_line}", ruby_method, .encode("UTF-8")] end |