Skip to content

Respond to application errors with configurable notifiers

License

Notifications You must be signed in to change notification settings

restaurant-cheetah/fuli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fuli

Respond to application errors with configurable notifiers

Gem Version

Install

gem install fuli_the_guard

Configuration

# Notifier could be any callable object that gets error param
Fuli.configure do |config|
  config.logger = YourLogger
  config.warn_notifiers = [
    ->(error, message){ do_something_with(error, message) }]
  config.error_notifiers = [
    proc { |error, message| do_something_with(error, message) }]
end

# Or using class instead of proc / lambda
class SomeNotifier
  class << self
    def call(error, message)
      # notify some service
    end
  end
end

Fuli.configure do |config|
  config.logger = YourLogger
  config.warn_notifiers = [SomeNotifier]
end

Example

class Cheetah
  def hunt_em
    # do things
  rescue => e
    context_message = { custom: 'context', more: :things }
    Fuli.notify_error(e, context_message)
  end

  def follow_em
    # do more things
    warn_message = 'May be something gonna brake..'
    Fuli.notify_warning(warn_message)
  end
end

Releases

No releases published

Packages

No packages published

Languages