Class: Everywhere::LogFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/everywhere/log_filter.rb

Overview

Turns the raw, chatty output of the external build tools (tebako, the notarize script and the Apple tools it drives) into clean, indented, colored lines for the console and the Platform web log.

A filter is a small state machine fed one raw line at a time. It returns:

* a String  -> print this (already colored/indented) instead of the raw line
* :drop     -> swallow the line (pure noise: repeated status, temp paths…)
* nil       -> not recognized; caller shows the raw line dimmed as a detail

The FULL raw stream is always still written to the on-disk log, so nothing is lost — this only governs what a human sees scroll by.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(profile) ⇒ LogFilter

Returns a new instance of LogFilter.



20
21
22
23
# File 'lib/everywhere/log_filter.rb', line 20

def initialize(profile)
  @profile = profile
  @seen = {}
end

Class Method Details

.for(profile) ⇒ Object



18
# File 'lib/everywhere/log_filter.rb', line 18

def self.for(profile) = new(profile)

Instance Method Details

#call(raw) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/everywhere/log_filter.rb', line 25

def call(raw)
  line = raw.to_s.rstrip
  return :drop if line.empty?

  case @profile
  when :notarize then notarize(line)
  when :tebako   then tebako(line)
  end
end