Module: Antrapol::ToolRack

Includes:
ConditionUtils
Defined in:
lib/toolrack.rb,
lib/toolrack/global.rb,
lib/toolrack/version.rb,
lib/toolrack/arg_utils.rb,
lib/toolrack/cli_utils.rb,
lib/toolrack/file_utils.rb,
lib/toolrack/hash_config.rb,
lib/toolrack/null_output.rb,
lib/toolrack/process_utils.rb,
lib/toolrack/runtime_utils.rb,
lib/toolrack/version_utils.rb,
lib/toolrack/password_utils.rb,
lib/toolrack/terminal_utils.rb,
lib/toolrack/condition_utils.rb,
lib/toolrack/exception_utils.rb,
lib/toolrack/block_params_utils.rb,
lib/toolrack/data_conversion_utils.rb

Defined Under Namespace

Modules: ArgUtils, BlockParamsUtils, CliUtils, ConditionUtils, DataConversionUtils, ExceptionUtils, FileUtils, HashConfig, PasswordUtils, ProcessUtils, RuntimeUtils, TerminalUtils, VersionUtils Classes: Error, Logger, NullOutput, ProcessUtilsEngine, TerminalUtilsException

Constant Summary collapse

DataConvUtils =

TR = ToolRack

Antrapol::ToolRack::DataConversionUtils
CondUtils =
ToolRack::ConditionUtils
PassUtils =
ToolRack::PasswordUtils
ExpUtils =
ToolRack::ExceptionUtils
RTUtils =
ToolRack::RuntimeUtils
VERSION =
"0.24.3"

Class Method Summary collapse

Class Method Details

.logger(tag = nil, &block) ⇒ Object

Your code goes here…



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/toolrack.rb', line 32

def self.logger(tag = nil, &block)
  if @_logger.nil?
    trLogout = ENV["TR_LOGOUT"]
    if not_empty?(trLogout)
      @_logger = TeLogger::Tlogger.new(trLogout, 5, 5*1024*1024)
    else
      @_logger = TeLogger::Tlogger.new('toolrack.log', 5, 5*1024*1024)
    end
  end

  if block
    if not_empty?(tag)
      @_logger.with_tag(tag, &block)
    else
      @_logger.with_tag(@_logger.tag, &block)
    end
  else
    if is_empty?(tag)
      @_logger.tag = :tr
      @_logger
    else
      # no block but tag is given? hmm
      @_logger.tag = tag
      @_logger
    end
  end

end