CFEL - ASG Software Suite  2.5.0
CASS
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
cass::Log Class Reference

a logger for logging debug and info messages More...

#include <log.h>

+ Collaboration diagram for cass::Log:

Public Types

enum  Level {
  ERROR, WARNING, INFO, VERBOSEINFO,
  DEBUG0, DEBUG1, DEBUG2, DEBUG3,
  DEBUG4, nbrOfLogLevel
}
 the logging levels available More...
 

Public Member Functions

 ~Log ()
 destructor More...
 

Static Public Member Functions

static Logref ()
 retrive a reference to the singleton instance More...
 
static void add (Level level, const std::string &line)
 add a string to the log More...
 
static void loadSettings ()
 load the logging settings from the .ini file More...
 
static std::string filename ()
 return the name of the log file More...
 

Private Member Functions

 Log ()
 constructor More...
 
void addline (Level level, const std::string &line)
 add a string to the log More...
 
void load ()
 load the logging settings from the .ini file More...
 

Private Attributes

std::ofstream _log
 the stream that we write the log messages to More...
 
std::string _buffer
 a buffer for concatinating the message More...
 
std::string _filename
 the filename of the log file More...
 

Static Private Attributes

static std::tr1::shared_ptr< Log_instance
 the instance More...
 
static QMutex _lock
 mutex to lock the singleton More...
 
static Level _loggingLevel =Log::INFO
 the used logging level More...
 
static const char * _level2string []
 map the level to a string More...
 

Detailed Description

a logger for logging debug and info messages

class is a singleton so one can call it from everywhere

User definable Parameters:

Log/{MaxLoggingLevel}
The maximum Level of output requested.

Log/{Directory}
The directory where the log file will be written to. Default is the directory that cass was started in.

Log/{Filename}
The name of the log file. Default is "casslog_%yyyyMMdd%".

Author
Lutz Foucar

Definition at line 35 of file log.h.

Member Enumeration Documentation

the logging levels available

Enumerator
ERROR 
WARNING 
INFO 
VERBOSEINFO 
DEBUG0 
DEBUG1 
DEBUG2 
DEBUG3 
DEBUG4 
nbrOfLogLevel 

Definition at line 39 of file log.h.

Constructor & Destructor Documentation

Log::~Log ( )

destructor

closes the log file

Definition at line 90 of file log.cpp.

Log::Log ( )
private

constructor

open the file that contains the logging output. One can set the directory via the .ini file. The name is always composed out of "casslog_yyyyMMdd.log" where yyyy encodes the year, MM the month and dd the day. The log file is opened such that new entries will always be appended to the file.

Note
private so one can only create the instance from the static function

Definition at line 57 of file log.cpp.

Member Function Documentation

void Log::add ( Level  level,
const std::string &  line 
)
static

add a string to the log

Parameters
levelthe level of importance that the log message has
linestring containing the line that should be added to the log

Definition at line 31 of file log.cpp.

Referenced by cass::pp2000::aboutToQuit(), cass::Processor::aboutToQuit(), cass::pixeldetector::OnlineFixedCreator::buildAndCalc(), cass::pixeldetector::OnlineFixedCreatorCommonMode::buildAndCalc(), cass::SACLAConverter::detTileParams::cache(), cass::SACLAConverter::cacheParameters(), cass::TCPInput::connectToServer(), cass::pixeldetector::OnlineFixedCreator::controlCalibration(), cass::pixeldetector::GainCalibration::controlCalibration(), cass::pixeldetector::CommonData::controlCalibration(), cass::pixeldetector::MovingMaps::controlCalibration(), cass::pixeldetector::OnlineFixedCreatorCommonMode::controlCalibration(), cass::pixeldetector::copyAdditionalPnccdInfo(), cass::DetectorTile::copyData(), cass::ProcessorManager::create(), cass::pixeldetector::createCASSMask(), cass::pixeldetector::CommonData::createCorMap(), cass::hdf5::createGroupNameFromEventId(), cass::IdList::deserialize(), cass::pixeldetector::DetectorHelper::DetectorHelper(), cass::SharedMemoryInput::end(), cass::ROOT::eventIdToDirectoryName(), cass::FileInput::FileInput(), cass::HDF5FileInput::HDF5FileInput(), cass::ACQIRIS::HelperAcqirisDetectors::HelperAcqirisDetectors(), cass::IdList::IdList(), cass::pixeldetector::DetectorHelper::instance(), cass::ACQIRIS::HelperAcqirisDetectors::instance(), cass::pixeldetector::CommonData::instance(), cass::ProcessorManager::instance(), cass::pixeldetector::isSameSize(), iterate(), cass::pp330::loadCalibration(), cass::pp332::loadHotPixelMap(), cass::pp310::loadSettings(), cass::pp200::loadSettings(), cass::pp1500::loadSettings(), cass::pp105::loadSettings(), cass::pp301::loadSettings(), cass::pp72::loadSettings(), cass::pp150::loadSettings(), cass::pp110::loadSettings(), cass::pp203::loadSettings(), cass::pp5000::loadSettings(), cass::pp2001::loadSettings(), cass::pp1::loadSettings(), cass::pp400::loadSettings(), cass::pp312::loadSettings(), cass::pixeldetector::OnlineFixedCreator::loadSettings(), cass::pp311::loadSettings(), cass::pp240::loadSettings(), cass::pp120::loadSettings(), cass::SACLAConverter::loadSettings(), cass::HexCalibrator::loadSettings(), cass::pp2000::loadSettings(), cass::pp111::loadSettings(), cass::pp5001::loadSettings(), cass::pp73::loadSettings(), cass::pp151::loadSettings(), cass::pp107::loadSettings(), cass::pp204::loadSettings(), cass::pp55::loadSettings(), cass::pp201::loadSettings(), cass::pp121::loadSettings(), cass::Processor::loadSettings(), cass::pp2::loadSettings(), cass::pp302::loadSettings(), cass::pp1002::loadSettings(), cass::pp330::loadSettings(), cass::pp112::loadSettings(), cass::pp152::loadSettings(), cass::pp74::loadSettings(), cass::pp109::loadSettings(), cass::pp313::loadSettings(), cass::pp122::loadSettings(), cass::pixeldetector::MovingMaps::loadSettings(), cass::pixeldetector::CommonData::loadSettings(), cass::pp404::loadSettings(), cass::pp202::loadSettings(), cass::pixeldetector::OnlineFixedCreatorCommonMode::loadSettings(), cass::pp153::loadSettings(), cass::pp79::loadSettings(), cass::pp1600::loadSettings(), cass::pp144::loadSettings(), cass::pp123::loadSettings(), cass::pp4::loadSettings(), cass::pp205::loadSettings(), cass::pixeldetector::HotPixelsFinder::loadSettings(), cass::pp145::loadSettings(), cass::pp130::loadSettings(), cass::pp160::loadSettings(), cass::pp9::loadSettings(), cass::pp500::loadSettings(), cass::pp405::loadSettings(), cass::pp206::loadSettings(), cass::pp146::loadSettings(), cass::pp12::loadSettings(), cass::pp161::loadSettings(), cass::pp406::loadSettings(), cass::pp1601::loadSettings(), cass::pp148::loadSettings(), cass::pp13::loadSettings(), cass::pp331::loadSettings(), cass::pp208::loadSettings(), cass::pp149::loadSettings(), cass::pp14::loadSettings(), cass::pp162::loadSettings(), cass::pp15::loadSettings(), cass::pp407::loadSettings(), cass::pp163::loadSettings(), cass::pp230::loadSettings(), cass::pp332::loadSettings(), cass::pp40::loadSettings(), cass::pp241::loadSettings(), cass::pp164::loadSettings(), cass::pp242::loadSettings(), cass::ProcessorManager::loadSettings(), cass::pp333::loadSettings(), cass::pp90::loadSettings(), cass::pp408::loadSettings(), cass::pp41::loadSettings(), cass::pp209::loadSettings(), cass::pp243::loadSettings(), cass::pp165::loadSettings(), cass::pp334::loadSettings(), cass::pp50::loadSettings(), cass::pp244::loadSettings(), cass::pp166::loadSettings(), cass::pp410::loadSettings(), cass::pp210::loadSettings(), cass::pp51::loadSettings(), cass::pp412::loadSettings(), cass::pp167::loadSettings(), cass::pp56::loadSettings(), cass::pp220::loadSettings(), cass::pp57::loadSettings(), cass::pp250::loadSettings(), cass::pp251::loadSettings(), cass::pp60::loadSettings(), cass::pp252::loadSettings(), cass::pp61::loadSettings(), cass::pp62::loadSettings(), cass::pp63::loadSettings(), cass::pp64::loadSettings(), cass::pp65::loadSettings(), cass::pp66::loadSettings(), cass::pp68::loadSettings(), cass::pp69::loadSettings(), cass::pp70::loadSettings(), cass::pp71::loadSettings(), cass::pp75::loadSettings(), cass::pp76::loadSettings(), cass::pp77::loadSettings(), cass::pp78::loadSettings(), cass::pp81::loadSettings(), cass::pp82::loadSettings(), cass::pp85::loadSettings(), cass::pp86::loadSettings(), cass::pp87::loadSettings(), cass::pp88::loadSettings(), cass::pp89::loadSettings(), cass::pp91::loadSettings(), cass::MachineData::Converter::operator()(), cass::ACQIRIS::Converter::operator()(), cass::FormatConverter::operator()(), cass::SACLAConverter::operator()(), cass::pixeldetector::Converter::operator()(), cass::XtcIterator::process(), cass::pp330::process(), cass::Processor::process(), cass::pp330::processCommand(), cass::Processor::processCommand(), cass::Processor::processEvent(), cass::ProcessorManager::ProcessorManager(), cass::RatePlotter::RatePlotter(), cass::pixeldetector::readCASSGainFile(), cass::pixeldetector::readCASSHotPixFile(), cass::pixeldetector::readCASSOffsetFile(), cass::pixeldetector::RAWSSSReader::readHeaderInfo(), cass::ACQIRIS::LmaReader::readHeaderInfo(), cass::TxtReader::readHeaderInfo(), cass::pixeldetector::readHLLGainFile(), cass::pixeldetector::readHLLOffsetFile(), cass::TestInput::run(), cass::SoapServer::run(), cass::RatePlotter::run(), cass::DetectorTile::runNumber(), cass::ACQIRIS::LMAParser::runthis(), cass::ZMQInput::runthis(), cass::SharedMemoryInput::runthis(), cass::FileInput::runthis(), cass::SACLAOfflineInput::runthis(), cass::XFELOnlineInput::runthis(), cass::TCPInput::runthis(), cass::MultiFileInput::runthis(), cass::XFELHDF5FileInput::runthis(), cass::SACLAOnlineInput::runthis(), cass::HDF5FileInput::runthis(), cass::SACLAConverter::SACLAConverter(), cass::SACLAOfflineInput::SACLAOfflineInput(), cass::SACLAOnlineInput::SACLAOnlineInput(), cass::FileParser::savePos(), cass::set1DHist(), cass::set2DHist(), cass::pp330::setBadPixMap(), cass::pp1602::setup(), cass::Processor::setupDependency(), cass::SoapServer::SoapServer(), cass::DetectorTile::tag(), cass::TestInput::TestInput(), cass::pixeldetector::MovingMaps::train(), and cass::XFELHDF5FileInput::XFELHDF5FileInput().

void Log::addline ( Level  level,
const std::string &  line 
)
private

add a string to the log

will put the date, time, message level and then the string to the logging

Parameters
levelthe level of importance that the log message has
linestring containing the line that should be added to the log

Definition at line 95 of file log.cpp.

References QDateTime::currentDateTime().

string Log::filename ( )
static

return the name of the log file

if the instance has not yet been created create the logging instance.

Definition at line 49 of file log.cpp.

void Log::load ( )
private

load the logging settings from the .ini file

Sets the logging message level that will be put into the log file and the position and name of the file.

The log file will be created from the current date and the user defined directory. It will only be opened if the file has not been opened yet. If the name of the file (including the absolute path) has changed, close it (if it was open) and open it with the new filename.

Definition at line 62 of file log.cpp.

References QSettings::beginGroup(), QDateTime::currentDateTime(), QDir::currentPath(), cass::toString(), and QSettings::value().

void Log::loadSettings ( )
static

load the logging settings from the .ini file

if the instance has not yet been created create the logging instance.

Definition at line 41 of file log.cpp.

static Log& cass::Log::ref ( )
static

retrive a reference to the singleton instance

Returns
reference to the log singleton instance

Member Data Documentation

std::string cass::Log::_buffer
private

a buffer for concatinating the message

Definition at line 115 of file log.h.

std::string cass::Log::_filename
private

the filename of the log file

Definition at line 118 of file log.h.

std::tr1::shared_ptr< Log > Log::_instance
staticprivate

the instance

Definition at line 109 of file log.h.

const char * Log::_level2string
staticprivate
Initial value:
=
{"ERROR ","WARNING ","INFO ","VERBOSEINFO ","DEBUG ","DEBUG1 ","DEBUG2 ","DEBUG3 ","DEBUG4 "}

map the level to a string

Definition at line 127 of file log.h.

QMutex Log::_lock
staticprivate

mutex to lock the singleton

Definition at line 121 of file log.h.

std::ofstream cass::Log::_log
private

the stream that we write the log messages to

Definition at line 112 of file log.h.

Log::Level Log::_loggingLevel =Log::INFO
staticprivate

the used logging level

Definition at line 124 of file log.h.


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