openModeller  Version 1.5.0
Log Class Reference

#include <Log.hh>

Collaboration diagram for Log:
Collaboration graph

Classes

class  LogCallback
 
class  OstreamCallback
 

Public Types

enum  Level {
  Debug =0, Default =1, Info =2, Warn =3,
  Error =4
}
 

Public Member Functions

 ~Log ()
 
void set (Level level, std::string fileName, char const *pref="")
 
void setCallback (LogCallback *lc)
 
void setLevel (Level level)
 
void setPrefix (const char *pref)
 
void debug (const char *format,...)
 'Debug' level. More...
 
void info (const char *format,...)
 'Info' level. More...
 
void warn (const char *format,...)
 'Warn' level. More...
 
void error (const char *format,...)
 'Error' level. More...
 
void operator() (const char *format,...)
 

Static Public Member Functions

static Loginstance ()
 Returns the instance pointer, creating the object on the first call. More...
 
static std::string format (const char *fmt,...)
 

Protected Member Functions

 Log ()
 

Private Member Functions

void FormatAndWrite (Log::LogCallback &lc, Log::Level level, std::string pref, const char *format, va_list ap)
 

Private Attributes

LogCallbackcallback
 
Level _level
 
std::string _pref
 
bool _deleteCallback
 

Static Private Attributes

static LogmpInstance = 0
 

Detailed Description

Declaration of Log class.

Author
Mauro E S Muņoz mauro.nosp@m.@cri.nosp@m.a.org.nosp@m..br
Date
2003-03-28
Id:
Log.hh 5670 2013-02-04 15:43:08Z dbolgheroni

LICENSE INFORMATION

Copyright(c) 2003 by CRIA - Centro de Referencia em Informacao Ambiental

http://www.cria.org.br

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details:

http://www.gnu.org/copyleft/gpl.html A Singleton Class that allows sending of log messages to "stream" devices. A system interface class with more advanced logging mechanisms (libraries).

Definition at line 48 of file Log.hh.

Member Enumeration Documentation

enum Log::Level
Enumerator
Debug 
Default 
Info 
Warn 
Error 

Definition at line 54 of file Log.hh.

Constructor & Destructor Documentation

Log::Log ( )
protected

Protected constructor

Definition at line 171 of file Log.cpp.

References _deleteCallback, _level, Debug, and setPrefix().

Referenced by instance().

Here is the call graph for this function:

Log::~Log ( )

Definition at line 183 of file Log.cpp.

References _deleteCallback, and callback.

Member Function Documentation

void Log::debug ( const char *  format,
  ... 
)

'Debug' level.

Definition at line 237 of file Log.cpp.

References _level, _pref, callback, Debug, and FormatAndWrite().

Referenced by AquaMaps::_calculateEnvelopes(), RocCurve::_calculateGraphPoints(), RocCurve::_loadPredictions(), AquaMaps::_readSpeciesData(), AlgorithmImpl::AlgorithmImpl(), ConfusionMatrix::calculate(), OpenModeller::calculateModelStatistics(), Csm::center(), EnvironmentImpl::checkCoordinates(), ScaleNormalizer::computeNormalization(), MapFormat::copyDefaults(), OccurrencesFactory::create(), Csm::csm1(), CsmBS::discardComponents(), NNAlgorithm::done(), RocCurve::getPartialAreaRatio(), EnvironmentImpl::getUnnormalizedInternal(), EnvironmentalDistance::initialize(), AlgorithmRun::initialize(), CsmBS::initialize(), CacheManager::initialize(), NNAlgorithm::initialize(), Csm::initialize(), initialPluginPath(), initRandom(), BestSubsets::iterate(), DelimitedTextOccurrences::load(), Settings::loadConfig(), main(), AlgorithmFactory::newAlgorithm(), ReferenceCountedPointer< T >::operator=(), AlgorithmFactory::p_addDll(), readDirectory(), ReferenceCountedPointer< T >::ReferenceCountedPointer(), RocCurve::reset(), PreJackknife::runImplementation(), SamplerImpl::SamplerImpl(), Csm::SamplerToMatrix(), AlgorithmFactory::searchDefaultDirs(), SamplerImpl::setConfiguration(), ConfusionMatrix::setLowestTrainingThreshold(), OpenModeller::setModelConfiguration(), OpenModeller::setProjectionConfiguration(), ReferenceCountedPointer< T >::takePointer(), AlgorithmImpl::~AlgorithmImpl(), AlgorithmFactory::DLL::~DLL(), ReferenceCountedPointer< T >::~ReferenceCountedPointer(), and SamplerImpl::~SamplerImpl().

Here is the call graph for this function:

void Log::error ( const char *  format,
  ... 
)

'Error' level.

Definition at line 290 of file Log.cpp.

References _level, _pref, callback, Error, and FormatAndWrite().

Referenced by EnvironmentalDistance::_calc_covariance_matrix(), AquaMaps::_getAndCheckParameter(), RocCurve::_loadPredictions(), TapirOccurrences::_parseCapabilities(), GbifOccurrences::_parseServiceInfo(), GbifOccurrences::_retrieveRecords(), TapirOccurrences::_retrieveRecords(), ConsensusAlgorithm::_setAlgorithm(), RequestFile::_setAlgorithm(), ConsensusAlgorithm::_setConfiguration(), EnvironmentalDistance::_setConfiguration(), Garp::_setConfiguration(), AquaMaps::_setConfiguration(), RequestFile::_setEnvironment(), RequestFile::_setOccurrences(), RequestFile::_setProjection(), AlgorithmFactory::algorithmMetadata(), PreAlgorithm::apply(), PreJackknifeFactory::build(), PreChiSquareFactory::build(), CacheManager::cache(), OpenModeller::calculateModelStatistics(), PreJackknife::checkParameters(), PreChiSquare::checkParameters(), GdalRaster::create(), OpenModeller::createMap(), AlgorithmImpl::createModel(), OpenModeller::createModel(), TerralibRaster::createRaster(), TerralibRaster::createTeRaster(), TerralibRaster::deleteRaster(), GarpRule::evaluate(), GdalRaster::finish(), SamplerImpl::generateRandomSample(), AlgorithmImpl::getFreshCopy(), PreAlgorithm::getLayerResult(), MapFormat::getNoDataValue(), SamplerImpl::getOneSample(), RequestFile::getPresences(), MapFormat::getProjection(), SamplerImpl::getPseudoAbsence(), SamplerImpl::getPseudoAbsenceOutsideInterval(), SamplerImpl::getPseudoPresence(), SamplerImpl::getPseudoPresenceInsideInterval(), EnvironmentImpl::getRandom(), MapFormat::getXCel(), MapFormat::getXMax(), MapFormat::getXMin(), MapFormat::getYCel(), MapFormat::getYMax(), MapFormat::getYMin(), PreChiSquare::init(), EnvironmentalDistance::initialize(), GarpAlgorithm::initialize(), MinimumDistance::initialize(), SvmAlgorithm::initialize(), Bioclim::initialize(), ConsensusAlgorithm::initialize(), EnvelopeScore::initialize(), RfAlgorithm::initialize(), NNAlgorithm::initialize(), BestSubsets::initialize(), NicheMosaic::initialize(), Garp::initialize(), AbstractBestSubsets::initialize(), AquaMaps::initialize(), isFromRejectedSource(), SvmAlgorithm::iterate(), DelimitedTextOccurrences::load(), TeOccurrences::load(), GbifOccurrences::load(), TapirOccurrences::load(), main(), PreFactory< T, Arg >::make(), RequestFile::makeModel(), RequestFile::makeProjection(), AbstractBestSubsets::needNormalization(), SamplerImpl::normalize(), GdalRaster::open(), TerralibRaster::openTeRaster(), PreAlgorithm::operator=(), PreAlgorithm::reset(), PreJackknife::runImplementation(), Garp::select(), OpenModeller::setAlgorithm(), AlgorithmImpl::setConfiguration(), SamplerImpl::setConfiguration(), NicheMosaic::setMinMaxDelta(), PreChiSquare::setNlayers(), MCNode< ObjectT, PreMultiContainerKeyT >::setObjPtr(), OpenModeller::setOccurrences(), OpenModeller::setProjectionConfiguration(), DgGarpBestSubsets::transferParametersToAlgorithm(), GarpBestSubsets::transferParametersToAlgorithm(), and GdalRaster::write().

Here is the call graph for this function:

std::string Log::format ( const char *  fmt,
  ... 
)
static

General function that can be used to generate formatted strings

Definition at line 142 of file Log.cpp.

Referenced by Projector::createMap().

void Log::FormatAndWrite ( Log::LogCallback lc,
Log::Level  level,
std::string  pref,
const char *  format,
va_list  ap 
)
private

Definition at line 120 of file Log.cpp.

References LevelLabels.

Referenced by debug(), error(), info(), operator()(), and warn().

void Log::info ( const char *  format,
  ... 
)

'Info' level.

Definition at line 256 of file Log.cpp.

References _level, _pref, callback, FormatAndWrite(), and Info.

Referenced by AquaMaps::_calculateEnvelopes(), EnvironmentalDistance::_init_distance_type(), RocCurve::_loadPredictions(), AquaMaps::_logEnvelope(), AquaMaps::_readSpeciesData(), GbifOccurrences::_retrieveRecords(), TapirOccurrences::_retrieveRecords(), RequestFile::_setEnvironment(), RequestFile::_setOccurrences(), RequestFile::_setProjection(), RocCurve::calculate(), AbstractBestSubsets::calculateBestSubset(), BestSubsets::calculateBestSubset(), OpenModeller::calculateModelStatistics(), Projector::createMap(), OpenModeller::createMap(), AlgorithmImpl::createModel(), OpenModeller::createModel(), VirtualNicheGenerator::dump(), Sample::dump(), OccurrenceImpl::dump(), OccurrencesImpl::dump(), SamplerImpl::environmentallyUnique(), errorHandler(), RocCurve::getPartialAreaRatio(), GbifOccurrences::getPresences(), TapirOccurrences::getPresences(), VirtualNicheGenerator::initialize(), SvmAlgorithm::initialize(), Bioclim::initialize(), DistanceToAverage::initialize(), EnvelopeScore::initialize(), AquaMaps::initialize(), VirtualNicheGenerator::iterate(), NNAlgorithm::iterate(), AquaMaps::iterate(), SerializedXmlOccurrences::load(), GbifOccurrences::load(), TapirOccurrences::load(), LogitRule::log(), NegatedRangeRule::log(), RangeRule::log(), GarpRule::log(), GarpRuleSet::log(), Bioclim::logEnvelope(), EnvelopeScore::logEnvelope(), main(), RequestFile::makeModel(), mapCallback(), modelCallback(), AbstractBestSubsets::needNormalization(), Header::printHeader(), PreJackknife::runImplementation(), BestSubsets::sortRuns(), SamplerImpl::spatiallyUnique(), and DistanceToAverage::~DistanceToAverage().

Here is the call graph for this function:

Log * Log::instance ( )
static

Returns the instance pointer, creating the object on the first call.

Definition at line 45 of file Log.cpp.

References Log(), and mpInstance.

Referenced by EnvironmentalDistance::_calc_covariance_matrix(), AquaMaps::_calculateEnvelopes(), RocCurve::_calculateGraphPoints(), AquaMaps::_getAndCheckParameter(), EnvironmentalDistance::_init_distance_type(), RocCurve::_loadPredictions(), AquaMaps::_logEnvelope(), TapirOccurrences::_parseCapabilities(), GbifOccurrences::_parseServiceInfo(), AquaMaps::_readSpeciesData(), GbifOccurrences::_retrieveRecords(), TapirOccurrences::_retrieveRecords(), ConsensusAlgorithm::_setAlgorithm(), RequestFile::_setAlgorithm(), ConsensusAlgorithm::_setConfiguration(), EnvironmentalDistance::_setConfiguration(), Garp::_setConfiguration(), AquaMaps::_setConfiguration(), RequestFile::_setEnvironment(), RequestFile::_setOccurrences(), RequestFile::_setProjection(), AlgorithmImpl::AlgorithmImpl(), AlgorithmFactory::algorithmMetadata(), PreAlgorithm::apply(), PreChiSquareFactory::build(), PreJackknifeFactory::build(), CacheManager::cache(), EnvironmentImpl::calcRegion(), RocCurve::calculate(), ConfusionMatrix::calculate(), AbstractBestSubsets::calculateBestSubset(), BestSubsets::calculateBestSubset(), OpenModeller::calculateModelStatistics(), Csm::center(), EnvironmentImpl::checkCoordinates(), PreJackknife::checkParameters(), PreChiSquare::checkParameters(), ScaleNormalizer::computeNormalization(), MapFormat::copyDefaults(), OccurrencesFactory::create(), GdalRaster::create(), Projector::createMap(), OpenModeller::createMap(), AlgorithmImpl::createModel(), OpenModeller::createModel(), TerralibRaster::createRaster(), TerralibRaster::createTeRaster(), Csm::csm1(), RemoteRaster::deleteRaster(), WcsProxyRaster::deleteRaster(), TerralibRaster::deleteRaster(), CsmBS::discardComponents(), NNAlgorithm::done(), VirtualNicheGenerator::dump(), Sample::dump(), OccurrenceImpl::dump(), OccurrencesImpl::dump(), SamplerImpl::environmentallyUnique(), errorHandler(), GarpRule::evaluate(), WcsProxyRaster::finish(), RemoteRaster::finish(), GdalRaster::finish(), SamplerImpl::generateRandomSample(), AlgorithmImpl::getFreshCopy(), PreAlgorithm::getLayerResult(), MapFormat::getNoDataValue(), SamplerImpl::getOneSample(), RocCurve::getPartialAreaRatio(), RequestFile::getPresences(), GbifOccurrences::getPresences(), TapirOccurrences::getPresences(), MapFormat::getProjection(), SamplerImpl::getPseudoAbsence(), SamplerImpl::getPseudoAbsenceOutsideInterval(), SamplerImpl::getPseudoPresence(), SamplerImpl::getPseudoPresenceInsideInterval(), EnvironmentImpl::getRandom(), EnvironmentImpl::getUnnormalizedInternal(), Csm::getValue(), MapFormat::getXCel(), MapFormat::getXMax(), MapFormat::getXMin(), MapFormat::getYCel(), MapFormat::getYMax(), MapFormat::getYMin(), PreChiSquare::init(), EnvironmentalDistance::initialize(), VirtualNicheGenerator::initialize(), GarpAlgorithm::initialize(), SvmAlgorithm::initialize(), MinimumDistance::initialize(), DistanceToAverage::initialize(), Bioclim::initialize(), ConsensusAlgorithm::initialize(), RfAlgorithm::initialize(), EnvelopeScore::initialize(), AlgorithmRun::initialize(), CsmBS::initialize(), CacheManager::initialize(), NNAlgorithm::initialize(), BestSubsets::initialize(), NicheMosaic::initialize(), Garp::initialize(), AbstractBestSubsets::initialize(), AquaMaps::initialize(), Csm::initialize(), initialPluginPath(), initRandom(), isFromRejectedSource(), VirtualNicheGenerator::iterate(), SvmAlgorithm::iterate(), NNAlgorithm::iterate(), BestSubsets::iterate(), AquaMaps::iterate(), SerializedXmlOccurrences::load(), DelimitedTextOccurrences::load(), TeOccurrences::load(), GbifOccurrences::load(), TapirOccurrences::load(), Settings::loadConfig(), LogitRule::log(), NegatedRangeRule::log(), RangeRule::log(), GarpRule::log(), GarpRuleSet::log(), Bioclim::logEnvelope(), EnvelopeScore::logEnvelope(), main(), PreFactory< T, Arg >::make(), RequestFile::makeModel(), RequestFile::makeProjection(), mapCallback(), modelCallback(), AbstractBestSubsets::needNormalization(), AlgorithmFactory::newAlgorithm(), SamplerImpl::normalize(), GdalRaster::open(), TerralibRaster::openTeRaster(), ReferenceCountedPointer< T >::operator=(), PreAlgorithm::operator=(), AlgorithmFactory::p_addDir(), AlgorithmFactory::p_addDll(), Header::printHeader(), RemoteRaster::put(), GdalRaster::put(), WcsProxyRaster::put(), readDirectory(), ReferenceCountedPointer< T >::ReferenceCountedPointer(), PreAlgorithm::reset(), RocCurve::reset(), PreJackknife::runImplementation(), SamplerImpl::SamplerImpl(), Csm::SamplerToMatrix(), AlgorithmFactory::searchDefaultDirs(), Garp::select(), OpenModeller::setAlgorithm(), AlgorithmImpl::setConfiguration(), OccurrencesImpl::setConfiguration(), SamplerImpl::setConfiguration(), OccurrencesImpl::setEnvironment(), MapFormat::setFormat(), OpenModeller::setLogLevel(), ConfusionMatrix::setLowestTrainingThreshold(), NicheMosaic::setMinMaxDelta(), OpenModeller::setModelConfiguration(), PreChiSquare::setNlayers(), MCNode< ObjectT, PreMultiContainerKeyT >::setObjPtr(), OpenModeller::setOccurrences(), OpenModeller::setProjectionConfiguration(), BestSubsets::sortRuns(), SamplerImpl::spatiallyUnique(), ReferenceCountedPointer< T >::takePointer(), DgGarpBestSubsets::transferParametersToAlgorithm(), GarpBestSubsets::transferParametersToAlgorithm(), GdalRaster::write(), AlgorithmImpl::~AlgorithmImpl(), DistanceToAverage::~DistanceToAverage(), AlgorithmFactory::DLL::~DLL(), ReferenceCountedPointer< T >::~ReferenceCountedPointer(), and SamplerImpl::~SamplerImpl().

Here is the call graph for this function:

void Log::operator() ( const char *  format,
  ... 
)

'Default' level.

Definition at line 307 of file Log.cpp.

References _level, _pref, callback, Default, and FormatAndWrite().

Here is the call graph for this function:

void Log::set ( Log::Level  level,
std::string  fileName,
char const *  pref = "" 
)

Configure the logger.

Parameters
levelLog level.
fileNameLog file name.
prefPrefix to be shown on every message.

Definition at line 196 of file Log.cpp.

References _deleteCallback, setCallback(), setLevel(), and setPrefix().

Referenced by main().

Here is the call graph for this function:

void Log::setCallback ( LogCallback lc)

Change the call back mechanism The Log object takes ownership of the object and will delete it when the Log is destroyed or when setCallback is called again

Definition at line 207 of file Log.cpp.

References _deleteCallback, and callback.

Referenced by set().

void Log::setLevel ( Level  level)
inline

Change log level.

Definition at line 107 of file Log.hh.

Referenced by main(), set(), and OpenModeller::setLogLevel().

void Log::setPrefix ( const char *  pref)

Change prefix to be shown before any message.

Definition at line 222 of file Log.cpp.

References _pref.

Referenced by Log(), main(), and set().

Member Data Documentation

bool Log::_deleteCallback
private

Definition at line 133 of file Log.hh.

Referenced by Log(), set(), setCallback(), and ~Log().

Level Log::_level
private

Definition at line 129 of file Log.hh.

Referenced by debug(), error(), info(), Log(), operator()(), and warn().

std::string Log::_pref
private

Definition at line 131 of file Log.hh.

Referenced by debug(), error(), info(), operator()(), setPrefix(), and warn().

LogCallback* Log::callback
private

Definition at line 127 of file Log.hh.

Referenced by debug(), error(), info(), operator()(), setCallback(), warn(), and ~Log().

Log * Log::mpInstance = 0
staticprivate

Definition at line 125 of file Log.hh.

Referenced by instance().


The documentation for this class was generated from the following files: