Module: TlaParserS::Utils::MyLogger

Included in:
Cli, Context, Parser, Resolver, SymbolTable
Defined in:
lib/utils/logger.rb

Defined Under Namespace

Classes: NullLoger

Constant Summary collapse

LOGFILE =
"tla-parser-s.log"
@@logfile =

absolute path to log file

nil

Instance Method Summary collapse

Instance Method Details

#getLogger(progname = nil, options = {}) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/utils/logger.rb', line 33

def getLogger( progname=nil, options={} ) 

  progname = self.class.name.split('::').last if progname.nil?
  level = get_level( options )

  if level.nil? 

    return NullLoger.new 

  else
    
    logger = Logger.new( logfile( options ) )
    logger.level=level
    logger.progname = progname
    return logger

  end 

end

#logfile(options) ⇒ Object



28
29
30
31
# File 'lib/utils/logger.rb', line 28

def logfile( options )
  return @@logfile if @@logfile
  @@logfile = options[:logfile] || File.join( Dir.getwd, LOGFILE )
end