Class: Giblish::AsciidoctorLogger

Inherits:
Logger
  • Object
show all
Defined in:
lib/giblish/utils.rb

Overview

a logger customized to process info received from asciidoctors stdout.

Defined Under Namespace

Classes: UserInfoFormatter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user_info_log_level) ⇒ AsciidoctorLogger

Returns a new instance of AsciidoctorLogger.


74
75
76
77
78
# File 'lib/giblish/utils.rb', line 74

def initialize()
  super($stdout, progname: "(from asciidoctor)", formatter: UserInfoFormatter.new)
  @user_info_str = StringIO.new
  @user_info_logger = ::Logger.new(@user_info_str, formatter: UserInfoFormatter.new, level: )
end

Instance Attribute Details

#max_severityObject (readonly)

Returns the value of attribute max_severity.


72
73
74
# File 'lib/giblish/utils.rb', line 72

def max_severity
  @max_severity
end

#user_info_strObject (readonly)

Returns the value of attribute user_info_str.


72
73
74
# File 'lib/giblish/utils.rb', line 72

def 
  @user_info_str
end

Instance Method Details

#add(severity, message = nil, progname = nil) ⇒ Object


80
81
82
83
84
85
86
# File 'lib/giblish/utils.rb', line 80

def add(severity, message = nil, progname = nil)
  if (severity ||= UNKNOWN) > (@max_severity ||= severity)
    @max_severity = severity
  end
  @user_info_logger.add(severity, message, progname)
  super
end