Module: RailsSpotlight::LogInterceptor
- Defined in:
- lib/rails_spotlight/log_interceptor.rb
Constant Summary collapse
- SEVERITY =
%w[debug info warn error fatal unknown].freeze
- SEVERITY_MAP =
{ 0 => 'debug', 1 => 'info', 2 => 'warn', 3 => 'error', 4 => 'fatal', 5 => 'unknown' }.freeze
Instance Method Summary collapse
-
#add(severity, message = nil, progname = nil) ⇒ Object
rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity.
- #debug(message = nil, *args, &block) ⇒ Object
- #error(message = nil, *args, &block) ⇒ Object
- #fatal(message = nil, *args, &block) ⇒ Object
- #info(message = nil, *args, &block) ⇒ Object
- #unknown(message = nil, *args, &block) ⇒ Object
- #warn(message = nil, *args, &block) ⇒ Object
Instance Method Details
#add(severity, message = nil, progname = nil) ⇒ Object
rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rails_spotlight/log_interceptor.rb', line 10 def add(severity, = nil, progname = nil) # rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity severity ||= 5 return true if @logdev.nil? || severity < level progname = @progname if progname.nil? if .nil? if block_given? = yield else = progname progname = @progname end end return true if _skip_logging?() _rails_spotlight_log(SEVERITY_MAP[severity], , progname, :broadcast) super(severity, , progname) if defined?(super) true end |
#debug(message = nil, *args, &block) ⇒ Object
32 33 34 35 |
# File 'lib/rails_spotlight/log_interceptor.rb', line 32 def debug( = nil, *args, &block) _rails_spotlight_log(:debug, , nil, :event, &block) super end |
#error(message = nil, *args, &block) ⇒ Object
47 48 49 50 |
# File 'lib/rails_spotlight/log_interceptor.rb', line 47 def error( = nil, *args, &block) _rails_spotlight_log(:error, , nil, :event, &block) super end |
#fatal(message = nil, *args, &block) ⇒ Object
52 53 54 55 |
# File 'lib/rails_spotlight/log_interceptor.rb', line 52 def fatal( = nil, *args, &block) _rails_spotlight_log(:fatal, , nil, :event, &block) super end |
#info(message = nil, *args, &block) ⇒ Object
37 38 39 40 |
# File 'lib/rails_spotlight/log_interceptor.rb', line 37 def info( = nil, *args, &block) _rails_spotlight_log(:info, , nil, :event, &block) super end |
#unknown(message = nil, *args, &block) ⇒ Object
57 58 59 60 |
# File 'lib/rails_spotlight/log_interceptor.rb', line 57 def unknown( = nil, *args, &block) _rails_spotlight_log(:unknown, , nil, :event, &block) super end |
#warn(message = nil, *args, &block) ⇒ Object
42 43 44 45 |
# File 'lib/rails_spotlight/log_interceptor.rb', line 42 def warn( = nil, *args, &block) _rails_spotlight_log(:warn, , nil, :event, &block) super end |