Class: Plogger::Handler
- Inherits:
-
Object
- Object
- Plogger::Handler
- Defined in:
- lib/plogger/handler.rb
Instance Method Summary collapse
- #handle_debug(message, type: '', category: '', user_id: '', account_id: '', extra_info: {}) ⇒ Object
- #handle_error(message, type: '', category: '', user_id: '', account_id: '', extra_info: {}) ⇒ Object
- #handle_exception(exception, type: '', category: '', user_id: nil, account_id: nil, extra_info: {}) ⇒ Object
- #handle_info(message, type: '', category: '', user_id: '', account_id: '', extra_info: {}) ⇒ Object
- #handle_warning(message, type: '', category: '', user_id: '', account_id: '', extra_info: {}) ⇒ Object
-
#initialize(config) ⇒ Handler
constructor
A new instance of Handler.
Constructor Details
#initialize(config) ⇒ Handler
Returns a new instance of Handler.
6 7 8 9 10 |
# File 'lib/plogger/handler.rb', line 6 def initialize(config) @logger = config.logger @module = config.module @raven_dsn = config.raven_dsn end |
Instance Method Details
#handle_debug(message, type: '', category: '', user_id: '', account_id: '', extra_info: {}) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/plogger/handler.rb', line 46 def handle_debug(, type: '', category: '', user_id: '', account_id: '', extra_info: {}) result = (, category: category, user_id: user_id, account_id: account_id, type: type, extra_info: generate_extra_info(extra_info)) @logger.debug(result[:message]) result[:trace] end |
#handle_error(message, type: '', category: '', user_id: '', account_id: '', extra_info: {}) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/plogger/handler.rb', line 22 def handle_error(, type: '', category: '', user_id: '', account_id: '', extra_info: {}) result = (, category: category, user_id: user_id, account_id: account_id, type: type, extra_info: generate_extra_info(extra_info)) @logger.error(result[:message]) result[:trace] end |
#handle_exception(exception, type: '', category: '', user_id: nil, account_id: nil, extra_info: {}) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/plogger/handler.rb', line 12 def handle_exception(exception, type: '', category: '', user_id: nil, account_id: nil, extra_info: {}) unless @raven_dsn == nil || @raven_dsn.blank? Raven.user_context(id: user_id) Raven.(account_id: account_id) Raven.capture_exception(exception) end handle_error(exception., category: category, user_id: user_id, account_id: account_id, extra_info: extra_info, type: type) end |
#handle_info(message, type: '', category: '', user_id: '', account_id: '', extra_info: {}) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/plogger/handler.rb', line 38 def handle_info(, type: '', category: '', user_id: '', account_id: '', extra_info: {}) result = (, category: category, user_id: user_id, account_id: account_id, type: type, extra_info: generate_extra_info(extra_info)) @logger.info(result[:message]) result[:trace] end |
#handle_warning(message, type: '', category: '', user_id: '', account_id: '', extra_info: {}) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/plogger/handler.rb', line 30 def handle_warning(, type: '', category: '', user_id: '', account_id: '', extra_info: {}) result = (, category: category, user_id: user_id, account_id: account_id, type: type, extra_info: generate_extra_info(extra_info)) @logger.warn(result[:message]) result[:trace] end |