class SciolyFF::Validator::Logger

Prints extra information produced by validation process

Constants

DEBUG
ERROR
INFO
WARN

Attributes

log[R]
options[R]

Public Class Methods

new(loglevel, **options) click to toggle source
# File lib/sciolyff/validator/logger.rb, line 13
def initialize(loglevel, **options)
  @loglevel = loglevel
  @options = options
  flush
end

Public Instance Methods

debug(msg) click to toggle source
# File lib/sciolyff/validator/logger.rb, line 42
def debug(msg)
  return true if @loglevel < DEBUG

  @log << "DEBUG (possible intentional exception): #{msg}\n"
end
error(msg) click to toggle source
# File lib/sciolyff/validator/logger.rb, line 23
def error(msg)
  return false if @loglevel < ERROR

  @log << "ERROR (invalid SciolyFF): #{msg}\n"
  false # convenient for using logging the error as return value
end
flush() click to toggle source
# File lib/sciolyff/validator/logger.rb, line 19
def flush
  @log = String.new
end
info(msg) click to toggle source
# File lib/sciolyff/validator/logger.rb, line 36
def info(msg)
  return true if @loglevel < INFO

  @log << "INFO: #{msg}\n"
end
warn(msg) click to toggle source
# File lib/sciolyff/validator/logger.rb, line 30
def warn(msg)
  return true if @loglevel < WARN

  @log << "WARNING (still valid SciolyFF): #{msg}\n"
end