Class: Hubbado::Log::Logger::Substitute::Entry

Inherits:
Data
  • Object
show all
Defined in:
lib/hubbado/log/logger/substitute.rb

Overview

One line, as the logger read it rather than as the call site typed it.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



8
9
10
# File 'lib/hubbado/log/logger/substitute.rb', line 8

def data
  @data
end

#messageObject (readonly)

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



8
9
10
# File 'lib/hubbado/log/logger/substitute.rb', line 8

def message
  @message
end

#severityObject (readonly)

Returns the value of attribute severity

Returns:

  • (Object)

    the current value of severity



8
9
10
# File 'lib/hubbado/log/logger/substitute.rb', line 8

def severity
  @severity
end

#tagsObject (readonly)

Returns the value of attribute tags

Returns:

  • (Object)

    the current value of tags



8
9
10
# File 'lib/hubbado/log/logger/substitute.rb', line 8

def tags
  @tags
end

Instance Method Details

#at?(name) ⇒ Boolean

As a symbol, because #log takes a String as readily.

Returns:

  • (Boolean)


10
# File 'lib/hubbado/log/logger/substitute.rb', line 10

def at?(name) = severity == name.to_s.to_sym

#says?(pattern) ⇒ Boolean

A String names the line in full; a Regexp names enough of it to tell it from the others, without writing a record id into the spec.

Returns:

  • (Boolean)


14
15
16
17
18
# File 'lib/hubbado/log/logger/substitute.rb', line 14

def says?(pattern)
  return pattern.match?(message.to_s) if pattern.is_a?(Regexp)

  message == pattern
end

#tagged?(names) ⇒ Boolean

Every tag the line carries, and no others. Order is not compared: a call site writes them in whatever order reads well, and the allow-list never sees one either.

Returns:

  • (Boolean)


22
# File 'lib/hubbado/log/logger/substitute.rb', line 22

def tagged?(names) = tags.uniq.sort == names.uniq.sort