Class: RfLogger::ErrorNotification
- Inherits:
-
Object
- Object
- RfLogger::ErrorNotification
show all
- Defined in:
- lib/rf_logger/notifications/error_notification.rb,
lib/rf_logger/notifications/error_notification_environment_constraints.rb
Defined Under Namespace
Classes: EnvironmentConstraints
Class Method Summary
collapse
Class Method Details
.add_notifier(notifier, constraints = {}) ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/rf_logger/notifications/error_notification.rb', line 14
def add_notifier notifier, constraints={}
levels = constraints.delete(:levels) || RfLogger::LEVELS
constraint = ErrorNotification::EnvironmentConstraints.new(
RfLogger.configuration.environment,
constraints)
if constraint.valid_notifier?
levels.each do |level|
notifiers[level] << notifier
end
end
end
|
6
7
8
|
# File 'lib/rf_logger/notifications/error_notification.rb', line 6
def configure(&block)
yield self
end
|
.dispatch_error(log_info) ⇒ Object
26
27
28
29
30
|
# File 'lib/rf_logger/notifications/error_notification.rb', line 26
def dispatch_error(log_info)
notifiers[log_info.level.to_sym].each do |notifier|
notifier.send_notification log_info
end
end
|
.notifiers ⇒ Object
10
11
12
|
# File 'lib/rf_logger/notifications/error_notification.rb', line 10
def notifiers
@notifiers ||= Hash[RfLogger::LEVELS.map { |level| [level, []] }]
end
|
.reset! ⇒ Object
32
33
34
|
# File 'lib/rf_logger/notifications/error_notification.rb', line 32
def reset!
@notifiers = nil; notifiers
end
|