Sha256: a8136eb8546d68d7e4f76ec8446cf946b89a49711f14aabe0d235b5bc78c3143
Contents?: true
Size: 923 Bytes
Versions: 3
Compression:
Stored size: 923 Bytes
Contents
# frozen_string_literal: true module RailwayIpc class Logger attr_reader :logger def initialize(logger) @logger = logger end def info(message, statement) logger.info("[#{message_header(message)}] #{statement}") end def warn(message, statement) logger.warn("[#{message_header(message)}] #{statement}") end def debug(message, statement) logger.debug("[#{message_header(message)}] #{statement}") end def error(message, statement) logger.error("[#{message_header(message)}] #{statement}") end def log_exception(exception) logger.error(exception) end def message_header(message) log_statement = "message type: #{message.class}, uuid: #{message.uuid}, correlation_id: #{message.correlation_id}" message.respond_to?(:user_uuid) ? "#{log_statement}, user_uuid: #{message.user_uuid}" : log_statement end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
railway-ipc-1.1.0 | lib/railway_ipc/logger.rb |
railway-ipc-1.0.1 | lib/railway_ipc/logger.rb |
railway-ipc-1.0.0 | lib/railway_ipc/logger.rb |