class Asciidoctor::MemoryLogger

Constants

SEVERITY_SYMBOL_BY_VALUE

Attributes

messages[R]

Public Class Methods

new() click to toggle source
# File lib/asciidoctor/logging.rb, line 42
def initialize
  self.level = WARN
  @messages = []
end

Public Instance Methods

add(severity, message = nil, progname = nil) { |: progname| ... } click to toggle source
# File lib/asciidoctor/logging.rb, line 47
def add severity, message = nil, progname = nil
  message ||= block_given? ? yield : progname
  @messages << { severity: SEVERITY_SYMBOL_BY_VALUE[severity || UNKNOWN], message: message }
  true
end
clear() click to toggle source
# File lib/asciidoctor/logging.rb, line 53
def clear
  @messages.clear
end
empty?() click to toggle source
# File lib/asciidoctor/logging.rb, line 57
def empty?
  @messages.empty?
end
max_severity() click to toggle source
# File lib/asciidoctor/logging.rb, line 61
def max_severity
  empty? ? nil : @messages.map {|m| Severity.const_get m[:severity] }.max
end