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