Class: Wafris::LogSuppressor
- Inherits:
-
Object
- Object
- Wafris::LogSuppressor
- Defined in:
- lib/wafris/log_suppressor.rb
Class Method Summary collapse
- .current_environment ⇒ Object
- .puts_log(message) ⇒ Object
- .suppress_logs? ⇒ Boolean
- .suppressed_environments ⇒ Object
Class Method Details
.current_environment ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/wafris/log_suppressor.rb', line 18 def self.current_environment if defined?(Rails) Rails.env else ENV["RACK_ENV"] || "development" end end |
.puts_log(message) ⇒ Object
5 6 7 |
# File 'lib/wafris/log_suppressor.rb', line 5 def self.puts_log() puts("[Wafris] " + ) unless suppress_logs? end |
.suppress_logs? ⇒ Boolean
9 10 11 12 |
# File 'lib/wafris/log_suppressor.rb', line 9 def self.suppress_logs? suppressed_environments.include?(current_environment) || (ENV["WAFRIS_LOG_LEVEL"] && ENV["WAFRIS_LOG_LEVEL"] == "silent") end |
.suppressed_environments ⇒ Object
14 15 16 |
# File 'lib/wafris/log_suppressor.rb', line 14 def self.suppressed_environments ["test"] + (ENV["CI"] ? ["CI"] : []) end |