Class: Mbeditor::CableLogFilter

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/mbeditor/cable_log_filter.rb

Overview

Wraps the ActionCable logger and suppresses all log lines that mention Mbeditor channels so the development console stays readable. Non-Mbeditor ActionCable messages pass through unchanged.

Constant Summary collapse

SUPPRESS_PATTERN =
/Mbeditor::|mbeditor_editor/

Instance Method Summary collapse

Instance Method Details

#clear_tags!Object



50
51
52
53
54
# File 'lib/mbeditor/cable_log_filter.rb', line 50

def clear_tags!
  return __getobj__.clear_tags! if __getobj__.respond_to?(:clear_tags!)

  nil
end

#current_tagsObject

Rails/ActiveSupport logger compatibility. Some logger stacks call these methods even when the underlying logger is not TaggedLogging.



32
33
34
35
36
# File 'lib/mbeditor/cable_log_filter.rb', line 32

def current_tags
  return __getobj__.current_tags if __getobj__.respond_to?(:current_tags)

  []
end

#pop_tags(count = 1) ⇒ Object



44
45
46
47
48
# File 'lib/mbeditor/cable_log_filter.rb', line 44

def pop_tags(count = 1)
  return __getobj__.pop_tags(count) if __getobj__.respond_to?(:pop_tags)

  []
end

#push_tags(*tags) ⇒ Object



38
39
40
41
42
# File 'lib/mbeditor/cable_log_filter.rb', line 38

def push_tags(*tags)
  return __getobj__.push_tags(*tags) if __getobj__.respond_to?(:push_tags)

  tags
end

#tagged(*tags, &block) ⇒ Object

Tagged-logging compat — the block body still passes through the filter.



20
21
22
23
24
25
26
27
28
# File 'lib/mbeditor/cable_log_filter.rb', line 20

def tagged(*tags, &block)
  if __getobj__.respond_to?(:tagged)
    __getobj__.tagged(*tags, &block)
  elsif block
    block.call
  else
    self
  end
end