kspaceFirstOrder3D-CUDA  1.1
The CUDA/C++ implementation of the k-wave toolbox for the time-domain simulation of acoustic wave fields in 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TLogger Class Reference

Static class implementing the user interface by info messages. More...

#include <Logger.h>

Public Types

enum  TLogLevel { BASIC = 0, ADVANCED = 1, FULL = 2 }
 Log level of the message. More...
 

Static Public Member Functions

static void SetLevel (const TLogLevel actualLogLevel)
 Set the log level. More...
 
static TLogLevel GetLevel ()
 Get the log level.
 
template<typename... Args>
static void Log (const TLogLevel queryLevel, const std::string &format, Args...args)
 Log desired activity for a given log level, version with string format. More...
 
static void Log (const TLogLevel queryLevel, const std::string &message)
 Log desired activity for a given log level. More...
 
static void Error (const std::string &errorMessage)
 Log an error. More...
 
static void ErrorAndTerminate (const std::string &errorMessage)
 Log an error and terminate the execution. More...
 
static void Flush (const TLogLevel queryLevel)
 Flush output messages. More...
 
static std::string WordWrapString (const std::string &inputString, const std::string &delimiters, const int indentation=0, const int lineSize=65)
 Wrap the line based on logger conventions. More...
 
template<typename... Args>
static std::string FormatMessage (const std::string &format, Args...args)
 C++-11 replacement for sprintf that works with std::string instead of char *. More...
 

Private Member Functions

 TLogger ()
 Default constructor is not allowed, static class.
 
 TLogger (const TLogger &orig)
 Copy constructor is not allowed, static class.
 
 ~TLogger ()
 Destructor is not allowed, static class.
 

Static Private Member Functions

static std::string GetWord (std::istringstream &textStream, const std::string &delimiters)
 Extract a word (string between two delimiters) More...
 

Static Private Attributes

static TLogLevel logLevel = BASIC
 Log level of the logger. More...
 

Detailed Description

StaticClass used for printing out info and error message based on the verbose level. This is a static class.

Definition at line 50 of file Logger.h.

Member Enumeration Documentation

A enum to specify at which log level the message should be displayed, or the level set.

Enumerator
BASIC 

Basic (default) level of verbosity.

ADVANCED 

Advanced level of verbosity.

FULL 

Full level of verbosity.

Definition at line 60 of file Logger.h.

Member Function Documentation

void TLogger::Error ( const std::string &  errorMessage)
static

Log an error.

Parameters
[in]errorMessage- Error message to be printed out.

Definition at line 81 of file Logger.cpp.

void TLogger::ErrorAndTerminate ( const std::string &  errorMessage)
static

Log an error and terminate the execution.

Parameters
[in]errorMessage- error message to be printed to stderr

Definition at line 94 of file Logger.cpp.

Here is the caller graph for this function:

void TLogger::Flush ( const TLogLevel  queryLevel)
static

Flush logger, output messages only.

Parameters
[in]queryLevel- Log level of the flush

Definition at line 109 of file Logger.cpp.

Here is the caller graph for this function:

template<typename... Args>
static std::string TLogger::FormatMessage ( const std::string &  format,
Args...  args 
)
inlinestatic

The routine was proposed at http://stackoverflow.com/questions/2342162/stdstring-formatting-like-sprintf and should work with both Linux and VS 2013. However it still does not support string in formated arguments

Parameters
[in]format- Format string
[in]args- Arguments, std::string is not accepted
Returns
formated string

Definition at line 126 of file Logger.h.

Here is the caller graph for this function:

string TLogger::GetWord ( std::istringstream &  textStream,
const std::string &  delimiters 
)
staticprivate

Extract a word from a string stream based on delimiters.

Parameters
[in,out]textStream- Input text stream
[in]delimiters- List of delimiters as a single string
Returns
A word firm the string

Definition at line 200 of file Logger.cpp.

Here is the caller graph for this function:

template<typename... Args>
static void TLogger::Log ( const TLogLevel  queryLevel,
const std::string &  format,
Args...  args 
)
inlinestatic

Log desired activity and format it using format message.

Parameters
[in]queryLevel- What level to use
[in]format- Format string
[in]args- Arguments, std::string is not accepted

Definition at line 85 of file Logger.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void TLogger::Log ( const TLogLevel  queryLevel,
const std::string &  message 
)
static

end of SetLevel

Log desired activity.

Parameters
[in]queryLevel- Log level of the message
[in]message- Message to log

Definition at line 66 of file Logger.cpp.

void TLogger::SetLevel ( const TLogLevel  actualLogLevel)
static

Initialise or change logging level.

Parameters
[in]actualLogLevel- Log level for the logger

Definition at line 53 of file Logger.cpp.

Here is the caller graph for this function:

string TLogger::WordWrapString ( const std::string &  inputString,
const std::string &  delimiters,
const int  indentation = 0,
const int  lineSize = 65 
)
static

Wrap the line based on delimiters and align it with the rest of the logger output.

Parameters
[in]inputString- Input string
[in]delimiters- String of delimiters, every char is a delimiter
[in]indentation- Indentation from the beginning
[in]lineSize- Line size
Returns
Wrapped string
Note
The string must not contain tabulator and end-of-line characters.

Definition at line 130 of file Logger.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

TLogger::TLogLevel TLogger::logLevel = BASIC
staticprivate

static declaration of the LogLevel private field

Definition at line 156 of file Logger.h.


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