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



11
12
13
# File 'lib/logging_library/custom_formatter.rb', line 11

def logger_name
  @logger_name
end

#messageObject

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message



11
12
13
# File 'lib/logging_library/custom_formatter.rb', line 11

def message
  @message
end

#severityObject

Returns the value of attribute severity

Returns:

  • (Object)

    the current value of severity



11
12
13
# File 'lib/logging_library/custom_formatter.rb', line 11

def severity
  @severity
end

#timeObject

Returns the value of attribute time

Returns:

  • (Object)

    the current value of time



11
12
13
# File 'lib/logging_library/custom_formatter.rb', line 11

def time
  @time
end

Instance Method Details

#to_formatted_stringObject



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

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