Class: Stackify::LoggerClient
Instance Method Summary collapse
-
#initialize ⇒ LoggerClient
constructor
A new instance of LoggerClient.
- #log(level, msg, call_trace) ⇒ Object
- #log_exception(level = :error, ex) ⇒ Object
Constructor Details
#initialize ⇒ LoggerClient
Returns a new instance of LoggerClient.
4 5 6 |
# File 'lib/stackify/logger_client.rb', line 4 def initialize @@errors_governor = Stackify::ErrorsGovernor.new end |
Instance Method Details
#log(level, msg, call_trace) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/stackify/logger_client.rb', line 8 def log level, msg, call_trace Stackify::Utils. Stackify::MODES[:logging] do if acceptable?(level, msg) && Stackify.working? worker = Stackify::AddMsgWorker.new task = level, msg, call_trace worker.async_perform ScheduleDelay.new, task end end end |
#log_exception(level = :error, ex) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/stackify/logger_client.rb', line 18 def log_exception level= :error, ex if ex.is_a?(Stackify::StackifiedError) Stackify::Utils. Stackify::MODES[:logging] do if acceptable?(level, ex.) && Stackify.working? if @@errors_governor.can_send? ex worker = Stackify::AddMsgWorker.new task = log_exception_task level, ex worker.async_perform ScheduleDelay.new, task else Stackify.internal_log :warn, "LoggerClient: logging of exception with message \"#{ex.}\" is skipped - flood_limit is exceeded" end end end else Stackify.log_internal_error 'LoggerClient: log_exception should get StackifiedError object' end end |