Peano 4
No Matches
tarch::logging::LogFilterFileReader Class Reference

Read log filter spec file. More...

#include <LogFilterFileReader.h>

Collaboration diagram for tarch::logging::LogFilterFileReader:

Static Public Member Functions

static bool parsePlainTextFile (const std::string &filename)
 Tries to parse a simple text file where each line contains an entry.

Static Private Member Functions

static bool interpretTokens (const std::string &levelToken, const std::string &classNameToken, const std::string &rankToken, const std::string &onOffToken, const std::string &phaseToken)
static bool parseLine (std::ifstream &file, const std::string &filename, const std::string &line, int linenumber)
static std::string trimLine (const std::string &line)

Static Private Attributes

static tarch::logging::Log _log

Detailed Description

Read log filter spec file.

Very simple utility class offering a couple of static operations to parse different filter files for the command line logger. Each line specifies one filter list entry. Comment lines have to start with #. Here's an example for a valid configuration file:

# Level (info or debug) Trace Rank (-1 means all ranks) Black or white list entry
# General debug settings
debug tarch -1 black
debug peano -1 black
# General info settings
info tarch -1 white
info peano -1 white
info my::full::qualified::class::name -1 black
debug my::full::qualified::class::name 43 white
Have to include this header, as I need access to the SYCL_EXTERNAL keyword.
Definition accelerator.h:17
Tobias Weinzierl, Kristof Unterweger

Definition at line 49 of file LogFilterFileReader.h.

Member Function Documentation

◆ interpretTokens()

bool tarch::logging::LogFilterFileReader::interpretTokens ( const std::string & levelToken,
const std::string & classNameToken,
const std::string & rankToken,
const std::string & onOffToken,
const std::string & phaseToken )

◆ parseLine()

bool tarch::logging::LogFilterFileReader::parseLine ( std::ifstream & file,
const std::string & filename,
const std::string & line,
int linenumber )
Parsing has been successful

Definition at line 51 of file LogFilterFileReader.cpp.

References tarch::logging::LogFilter::FilterListEntry::AlwaysOn, logError, and logWarning.

◆ parsePlainTextFile()

bool tarch::logging::LogFilterFileReader::parsePlainTextFile ( const std::string & filename)

Tries to parse a simple text file where each line contains an entry.

If the file does not exist or the parse did not succeed, the operation writes an error and returns false. Otherwise, it returns true.

If the routine fails, it switches on all log information automatically. If you want to create a (hard-coded) fall-back logging, you thus might have to call clearFilterList() again before you continue.

Parsing has been successful

Definition at line 103 of file LogFilterFileReader.cpp.

References tarch::logging::LogFilter::addFilterListEntry(), tarch::logging::LogFilter::FilterListEntry::AlwaysOn, tarch::logging::LogFilter::FilterListEntry::AnyRank, tarch::logging::LogFilter::clearFilterList(), tarch::logging::LogFilter::getInstance(), logWarning, tarch::logging::LogFilter::FilterListEntry::TargetAll, and tarch::logging::LogFilter::FilterListEntry::WhiteListEntry.

Referenced by main(), and swift2::parseCommandLineArguments().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ trimLine()

std::string tarch::logging::LogFilterFileReader::trimLine ( const std::string & line)

Definition at line 95 of file LogFilterFileReader.cpp.

Field Documentation

◆ _log

tarch::logging::Log tarch::logging::LogFilterFileReader::_log

Definition at line 51 of file LogFilterFileReader.h.

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