Class: Truemail::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/truemail/logger.rb

Defined Under Namespace

Classes: Builder

Constant Summary collapse

BUILDER_ATTRS =
%i[tracking_event stdout log_absolute_path custom_logger].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event, error_stdout, log_absolute_path, custom_logger) ⇒ Logger

Returns a new instance of Logger.



60
61
62
63
64
65
66
# File 'lib/truemail/logger.rb', line 60

def initialize(event, error_stdout, log_absolute_path, custom_logger)
  @event = event
  @stdout = error_stdout
  @file = log_absolute_path
  @custom_logger = custom_logger
  init_builtin_loggers
end

Instance Attribute Details

#custom_loggerObject (readonly)

Returns the value of attribute custom_logger.



58
59
60
# File 'lib/truemail/logger.rb', line 58

def custom_logger
  @custom_logger
end

#eventObject (readonly)

Returns the value of attribute event.



58
59
60
# File 'lib/truemail/logger.rb', line 58

def event
  @event
end

#fileObject (readonly)

Returns the value of attribute file.



58
59
60
# File 'lib/truemail/logger.rb', line 58

def file
  @file
end

#file_loggerObject (readonly)

Returns the value of attribute file_logger.



58
59
60
# File 'lib/truemail/logger.rb', line 58

def file_logger
  @file_logger
end

#stdoutObject (readonly)

Returns the value of attribute stdout.



58
59
60
# File 'lib/truemail/logger.rb', line 58

def stdout
  @stdout
end

#stdout_loggerObject (readonly)

Returns the value of attribute stdout_logger.



58
59
60
# File 'lib/truemail/logger.rb', line 58

def stdout_logger
  @stdout_logger
end

Instance Method Details

#push(validator_instance) ⇒ Object



68
69
70
71
72
# File 'lib/truemail/logger.rb', line 68

def push(validator_instance)
  current_event = Truemail::Log::Event.new(event, validator_instance)
  return unless current_event.valid?
  create_logs(current_event.log_level, Truemail::Log::Serializer::ValidatorText.call(validator_instance))
end