Sha256: ada7bae748663d24631df66bd6cfacb0e1d42a427c8a95056dd9e8a809e5947e
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true require "dry-container" require "logger" require "pastel" module SublimeTextKit # Provides a global gem container for injection into other objects. module Container extend Dry::Container::Mixin register(:configuration) { Configuration::Loader.call } 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sublime_text_kit-12.0.1 | lib/sublime_text_kit/container.rb |
sublime_text_kit-12.0.0 | lib/sublime_text_kit/container.rb |