Module: BetterController::Logging
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/better_controller/logging.rb
Overview
Module providing logging capabilities
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#log_debug(message, tags = {}) ⇒ Object
Log a message at the debug level.
-
#log_error(message, tags = {}) ⇒ Object
Log a message at the error level.
-
#log_exception(exception, tags = {}) ⇒ Object
Log an exception.
-
#log_fatal(message, tags = {}) ⇒ Object
Log a message at the fatal level.
-
#log_info(message, tags = {}) ⇒ Object
Log a message at the info level.
-
#log_warn(message, tags = {}) ⇒ Object
Log a message at the warn level.
Instance Method Details
#log_debug(message, tags = {}) ⇒ Object
Log a message at the debug level
23 24 25 |
# File 'lib/better_controller/logging.rb', line 23 def log_debug(, = {}) log(:debug, , ) end |
#log_error(message, tags = {}) ⇒ Object
Log a message at the error level
37 38 39 |
# File 'lib/better_controller/logging.rb', line 37 def log_error(, = {}) log(:error, , ) end |
#log_exception(exception, tags = {}) ⇒ Object
Log an exception
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/better_controller/logging.rb', line 51 def log_exception(exception, = {}) return unless BetterController.config.error_handling[:log_errors] = .merge( exception_class: exception.class.name, backtrace: exception.backtrace&.join("\n") ) log_error(exception., ) end |
#log_fatal(message, tags = {}) ⇒ Object
Log a message at the fatal level
44 45 46 |
# File 'lib/better_controller/logging.rb', line 44 def log_fatal(, = {}) log(:fatal, , ) end |
#log_info(message, tags = {}) ⇒ Object
Log a message at the info level
16 17 18 |
# File 'lib/better_controller/logging.rb', line 16 def log_info(, = {}) log(:info, , ) end |
#log_warn(message, tags = {}) ⇒ Object
Log a message at the warn level
30 31 32 |
# File 'lib/better_controller/logging.rb', line 30 def log_warn(, = {}) log(:warn, , ) end |