Module: Perforce2Svn::Logging
- Included in:
- Mapping::Analyzer, Mapping::Parser, Migrator, Perforce::CommitBuilder, Perforce::P4Depot, Perforce::PerforceCommit, Perforce::PerforceFile, Subversion::SvnRepo, Subversion::SvnTransaction
- Defined in:
- lib/perforce2svn/logging.rb
Overview
A convenient module for mixins that allow to share the logging configuration everywhere easily
Constant Summary collapse
- @@log =
nil
Class Method Summary collapse
Instance Method Summary collapse
-
#log ⇒ Object
Meant for mixing into other classes for simplified logging.
Class Method Details
.configure(debug) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/perforce2svn/logging.rb', line 10 def self.configure(debug) if @@log.nil? @@log = Log4r::Logger.new 'perforce2svn' @@log.outputters = Log4r::Outputter.stdout @@log.level = if ENV['RSPEC_RUNNING'] Log4r::FATAL elsif debug Log4r::DEBUG else Log4r::INFO end Log4r::Outputter.stdout.formatter = Log4r::PatternFormatter.new(:pattern => "[%l]\t%M") end @@log end |
.log ⇒ Object
26 27 28 |
# File 'lib/perforce2svn/logging.rb', line 26 def self.log @@log ||= configure(true) end |