Sha256: a814554dfdbc34c22af0950d33dda42fe04648585a7b54e02682c8e70347ff1f
Contents?: true
Size: 1.18 KB
Versions: 4
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal: true require "dry-container" require "logger" require "pastel" require "spek" module SublimeTextKit # Provides a global gem container for injection into other objects. module Container extend Dry::Container::Mixin register(:configuration) { Configuration::Loader.call } register(:specification) { Spek::Loader.call "#{__dir__}/../../sublime_text_kit.gemspec" } register(:colorizer) { Pastel.new enabled: $stdout.tty? } register(:kernel) { Kernel } register :log_colors do { "DEBUG" => self[:colorizer].white.detach, "INFO" => self[:colorizer].green.detach, "WARN" => self[:colorizer].yellow.detach, "ERROR" => self[:colorizer].red.detach, "FATAL" => self[:colorizer].white.bold.on_red.detach, "ANY" => self[:colorizer].white.bold.detach } end register :logger do Logger.new $stdout, level: Logger.const_get(ENV.fetch("LOG_LEVEL", "INFO")), formatter: ( lambda do |severity, _at, _name, message| self[:log_colors][severity].call "#{message}\n" end ) end end end
Version data entries
4 entries across 4 versions & 1 rubygems