Class: LoggingLibrary::CustomFormatter::LogMessage

Inherits:
Struct
  • Object
show all
Defined in:
lib/logging_library/custom_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#logger_nameObject

Returns the value of attribute logger_name

Returns:

  • (Object)

    the current value of logger_name



13
14
15
# File 'lib/logging_library/custom_formatter.rb', line 13

def logger_name
  @logger_name
end

#messageObject

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



13
14
15
# File 'lib/logging_library/custom_formatter.rb', line 13

def message
  @message
end

#severityObject

Returns the value of attribute severity

Returns:

  • (Object)

    the current value of severity



13
14
15
# File 'lib/logging_library/custom_formatter.rb', line 13

def severity
  @severity
end

#timeObject

Returns the value of attribute time

Returns:

  • (Object)

    the current value of time



13
14
15
# File 'lib/logging_library/custom_formatter.rb', line 13

def time
  @time
end

Instance Method Details

#to_formatted_stringObject



14
15
16
17
18
19
20
21
# File 'lib/logging_library/custom_formatter.rb', line 14

def to_formatted_string
  if show_time?
    format("%s %s %s %s\n", formatted_colored_severity, formatted_colored_time,
           formatted_colored_logger_name, colored_message)
  else
    format("%-5s %s %s\n", formatted_colored_severity, formatted_colored_logger_name, colored_message)
  end
end