Class: Flexirest::Logger
- Inherits:
-
Object
- Object
- Flexirest::Logger
- Defined in:
- lib/flexirest/logger.rb
Class Method Summary collapse
- .debug(message) ⇒ Object
- .error(message) ⇒ Object
- .info(message) ⇒ Object
- .level ⇒ Object
- .logfile=(value) ⇒ Object
- .messages ⇒ Object
- .reset! ⇒ Object
- .warn(message) ⇒ Object
Class Method Details
.debug(message) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/flexirest/logger.rb', line 27 def self.debug() if defined?(Rails) && Rails.logger.present? Rails.logger.debug() elsif @logfile if @logfile.is_a?(String) File.open(@logfile, "a") do |f| f << "#{}\n" end else @logfile << "#{}\n" end else @messages << end end |
.error(message) ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/flexirest/logger.rb', line 75 def self.error() if defined?(Rails) && Rails.logger.present? Rails.logger.error() elsif @logfile if @logfile.is_a?(String) File.open(@logfile, "a") do |f| f << "#{}\n" end else @logfile << "#{}\n" end else @messages << end end |
.info(message) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/flexirest/logger.rb', line 43 def self.info() if defined?(Rails) && Rails.logger.present? Rails.logger.info() elsif @logfile if @logfile.is_a?(String) File.open(@logfile, "a") do |f| f << "#{}\n" end else @logfile << "#{}\n" end else @messages << end end |
.level ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/flexirest/logger.rb', line 19 def self.level if defined?(Rails) && Rails.logger.present? Rails.logger.level else 0 end end |
.logfile=(value) ⇒ Object
6 7 8 |
# File 'lib/flexirest/logger.rb', line 6 def self.logfile=(value) @logfile = value end |
.messages ⇒ Object
10 11 12 |
# File 'lib/flexirest/logger.rb', line 10 def self. @messages end |
.reset! ⇒ Object
14 15 16 17 |
# File 'lib/flexirest/logger.rb', line 14 def self.reset! @logfile = nil @messages = [] end |
.warn(message) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/flexirest/logger.rb', line 59 def self.warn() if defined?(Rails) && Rails.logger.present? Rails.logger.warn() elsif @logfile if @logfile.is_a?(String) File.open(@logfile, "a") do |f| f << "#{}\n" end else @logfile << "#{}\n" end else @messages << end end |