Sha256: 539ba24f9f7881f466cc3ec099eb37813a689c5b99b0c38f3a9caeae4ef6c563
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 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 if is_dev? new(STDOUT) else c = output_channel new(*c[:path]) end end private def is_dev? ENV.keys.include?("TLOGGER_MODE") and ENV["TLOGGER_MODE"].downcase == "dev" end 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.25.0 | lib/tlogger.rb |