Class: Yeller::StdoutVerifyLog

Inherits:
Object
  • Object
show all
Defined in:
lib/yeller/verify_log.rb

Class Method Summary collapse

Class Method Details

.about_to_raise_exception_in_controller!Object



116
117
118
# File 'lib/yeller/verify_log.rb', line 116

def self.about_to_raise_exception_in_controller!
  info("about to raise exception in fake controller")
end

.action_controller_instance_not_in_env!Object



96
97
98
99
100
# File 'lib/yeller/verify_log.rb', line 96

def self.action_controller_instance_not_in_env!
  warn("rack env didn't contain 'action_controller.instance', which should be set from rails.\n" +
       "Errors will still be logged, but they'll be missing a lot of useful information\n" +
       "check that your middleware doesn't mess with that key, and please contact [email protected] for more assistance")
end

.error(message) ⇒ Object



134
135
136
137
# File 'lib/yeller/verify_log.rb', line 134

def self.error(message)
  info(red("ERROR DETECTED:"))
  info(red(message))
end

.error_code_from_api!(response) ⇒ Object



106
107
108
109
# File 'lib/yeller/verify_log.rb', line 106

def self.error_code_from_api!(response)
  error("got a non successful response from yeller's api!: #{response.code} #{response.body}" +
       "\ncheck the api token is correct, and if you're still getting this error, contact [email protected]")
end

.error_reporting_rails_error!(e) ⇒ Object



91
92
93
94
# File 'lib/yeller/verify_log.rb', line 91

def self.error_reporting_rails_error!(e)
  error("error reporting rails error, please contact [email protected] with this message:\n" +
       e.inspect + "\n" + e.backtrace.join("\n"))
end

.exception_from_api!(e) ⇒ Object



111
112
113
114
# File 'lib/yeller/verify_log.rb', line 111

def self.exception_from_api!(e)
  error("got an exception whilst sending the test error to yeller's api servers. Please contact [email protected] with this message for help debugging.\n" +
       e.inspect + "\n" + e.backtrace.join("\n"))
end

.info(message) ⇒ Object



124
125
126
127
# File 'lib/yeller/verify_log.rb', line 124

def self.info(message)
  @log ||= []
  @log << "yeller: #{message}"
end

.monkey_patching_rails!(rails_class) ⇒ Object



83
84
85
# File 'lib/yeller/verify_log.rb', line 83

def self.monkey_patching_rails!(rails_class)
  info("monkeypatching rails #{rails_class}")
end


76
77
78
79
80
81
# File 'lib/yeller/verify_log.rb', line 76

def self.print_log!
  @log ||= []
  @log.each do |line|
    puts line
  end
end

.red(message) ⇒ Object



139
140
141
# File 'lib/yeller/verify_log.rb', line 139

def self.red(message)
  "\033[31m#{message}\033[0m"
end

.render_exception_with_yeller!Object



87
88
89
# File 'lib/yeller/verify_log.rb', line 87

def self.render_exception_with_yeller!
  info("rendering exception with yeller")
end

.reported_to_api!Object



102
103
104
# File 'lib/yeller/verify_log.rb', line 102

def self.reported_to_api!
  info("reported to api successfully!")
end

.reporting_to_yeller_rack!Object



120
121
122
# File 'lib/yeller/verify_log.rb', line 120

def self.reporting_to_yeller_rack!
  info("reporting via Yeller::Rack")
end

.warn(message) ⇒ Object



129
130
131
132
# File 'lib/yeller/verify_log.rb', line 129

def self.warn(message)
  info(red("WARNING:"))
  info(red(message))
end