Sha256: 046fa1827ca8c33881142a2c1e1c076d130f7baa481ad7b986ff5b427156ff65
Contents?: true
Size: 597 Bytes
Versions: 11
Compression:
Stored size: 597 Bytes
Contents
# frozen_string_literal: true require 'logger' class PgExport class BuildLogger FORMATS = { plain: ->(_, _, _, message) { "#{message}\n" }, muted: ->(*) { raise 'Do not initialize logger when it is muted' }, timestamped: lambda do |severity, datetime, progname, message| "#{datetime} #{Process.pid} TID-#{Thread.current.object_id.to_s(36)}#{progname} #{severity}: #{message}\n" end }.freeze def self.call(stream:, format:) Logger.new(stream).tap do |logger| logger.formatter = FORMATS.fetch(format.to_sym) end end end end
Version data entries
11 entries across 11 versions & 1 rubygems