class SemanticLogger::Formatters::Raw
def application
def application hash[:application] = logger.application if log_application && logger && logger.application end
def call(log, logger)
def call(log, logger) self.hash = {} self.log = log self.logger = logger host application environment time level pid thread_name file_name_and_line duration tags named_tags name message payload exception metric hash end
def duration
def duration return unless log.duration hash[:duration_ms] = log.duration hash[:duration] = log.duration_human end
def environment
def environment hash[:environment] = logger.environment if log_environment && logger && logger.environment end
def exception
def exception return unless log.exception root = hash log.each_exception do |exception, i| name = i.zero? ? :exception : :cause root[name] = { name: exception.class.name, message: exception.message, stack_trace: exception.backtrace } root = root[name] end end
def file_name_and_line
def file_name_and_line file, line = log.file_name_and_line return unless file hash[:file] = file hash[:line] = line.to_i end
def host
def host hash[:host] = logger.host if log_host && logger.host end
def initialize(time_format: :none, time_key: :time, **args)
def initialize(time_format: :none, time_key: :time, **args) @time_key = time_key super(time_format: time_format, **args) end
def level
def level hash[:level] = log.level hash[:level_index] = log.level_index end
def message
def message hash[:message] = log.cleansed_message if log.message end
def metric
def metric hash[:metric] = log.metric if log.metric hash[:metric_amount] = log.metric_amount if log.metric_amount end
def name
def name hash[:name] = log.name end
def named_tags
def named_tags hash[:named_tags] = log.named_tags if log.named_tags && !log.named_tags.empty? end
def payload
def payload hash[:payload] = log.payload if log.payload.respond_to?(:empty?) && !log.payload.empty? end
def pid
def pid hash[:pid] = super end
def tags
def tags hash[:tags] = log.tags if log.tags && !log.tags.empty? end
def thread_name
def thread_name hash[:thread] = log.thread_name end
def time
def time hash[time_key] = format_time(log.time) end