Class: Insights::Loggers::LoggingService::Formatter
- Inherits:
-
ManageIQ::Loggers::Container::Formatter
- Object
- ManageIQ::Loggers::Container::Formatter
- Insights::Loggers::LoggingService::Formatter
- Defined in:
- lib/insights/loggers/logging_service.rb
Instance Attribute Summary collapse
-
#logger_app_name ⇒ Object
Returns the value of attribute logger_app_name.
Instance Method Summary collapse
Instance Attribute Details
#logger_app_name ⇒ Object
Returns the value of attribute logger_app_name.
15 16 17 |
# File 'lib/insights/loggers/logging_service.rb', line 15 def logger_app_name @logger_app_name end |
Instance Method Details
#app_name ⇒ Object
35 36 37 |
# File 'lib/insights/loggers/logging_service.rb', line 35 def app_name logger_app_name || ENV['LOGGER_APP_NAME'] || "insights_application" end |
#call(severity, time, progname, msg) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/insights/loggers/logging_service.rb', line 18 def call(severity, time, progname, msg) payload = { :@timestamp => format_datetime(time), :hostname => hostname, :pid => $PROCESS_ID, :tid => thread_id, :service => progname, :level => translate_error(severity), :message => prefix_task_id(msg2str(msg)), :request_id => request_id, :tags => [app_name], :labels => {"app" => app_name} }.compact JSON.generate(payload) << "\n" end |