Class: Truemail::Logger

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event, error_stdout, log_absolute_path) ⇒ Logger

Returns a new instance of Logger.


9
10
11
12
13
# File 'lib/truemail/logger.rb', line 9

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

Instance Attribute Details

#eventObject (readonly)

Returns the value of attribute event


7
8
9
# File 'lib/truemail/logger.rb', line 7

def event
  @event
end

#fileObject (readonly)

Returns the value of attribute file


7
8
9
# File 'lib/truemail/logger.rb', line 7

def file
  @file
end

#stdoutObject (readonly)

Returns the value of attribute stdout


7
8
9
# File 'lib/truemail/logger.rb', line 7

def stdout
  @stdout
end

Instance Method Details

#push(validator_instance) ⇒ Object


15
16
17
18
19
# File 'lib/truemail/logger.rb', line 15

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