Sha256: 019dc0fddb07ff662848ffef22b0b76236a059d4e5044c61e7b904f283746e43

Contents?: true

Size: 786 Bytes

Versions: 1

Compression:

Stored size: 786 Bytes

Contents

# frozen_string_literal: true

PgExport::Container.boot :config do
  init do
    require 'logger'
    require 'pg_export/lib/pg_export/types'
    require 'pg_export/configuration'
  end

  start do
    config = PgExport::Configuration.build(ENV)

    formatters = {
      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
    }

    register(:logger, memoize: true) do
      Logger.new($stdout, formatter: formatters.fetch(config.logger_format.to_sym))
    end

    register(:config, memoize: true) { config }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pg_export-1.0.0.rc4 lib/pg_export/system/boot/config.rb