Sha256: 25ad3f3d8d6b3251ef20362e02876823c9420b602fcf8875eb32ebdbbe2c8931
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
require "tlogger/version" require_relative "tlogger/tlogger" require_relative "tlogger/logger_group" # # :nodoc: # module Tlogger class Error < StandardError; end # shorten the initializer to Tlogger.new instead of the longer Tlogger::Tlogger.new class << self def new(*args,&block) ::Tlogger::Tlogger.new(*args,&block) end # detect if the prompt should be to env or file def init p is_dev? if is_dev? new(STDOUT) else c = output_channel new(*c[:path]) end end def set_dev_mode ENV["TLOGGER_MODE"] = "dev" end def set_production_mode ENV.delete("TLOGGER_MODE") end def is_dev? ENV.keys.include?("TLOGGER_MODE") and ENV["TLOGGER_MODE"].downcase == "dev" end private def output_channel out = ENV["TLOGGER_OUT"] if not out.nil? case out when "file" path = ENV["TLOGGER_OUTPATH"] if path =~ /,/ { mode: :file, path: path.split(",") } else { mode: :file, path: [path] } end else { mode: :file, path: [nil] } end else { mode: :stdio, path: [nil] } end end end # class self end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tlogger-0.26.0 | lib/tlogger.rb |