dxFeed Graal CXX API v4.0.0
Loading...
Searching...
No Matches
Logging Struct Referencefinal

A class of utility methods for managing the logging mechanism. More...

#include <Logging.hpp>

Public Types

enum class  Level {
  ALL = 0 , TRACE , DEBUG , INFO ,
  WARN , ERROR , OFF
}
 Defines a set of standard logging levels that can be used to control logging output. More...
 

Static Public Member Functions

static std::string levelToString (Level level)
 Converts enum Level values to their string representation.
 
static void init (Level level=Level::OFF)
 Initializes logging and sets the logging level.
 
static void init (const std::string &logFile, Level logLevel=Level::INFO)
 Initializes logging, sets the path to the logging file and the logging level.
 
static void init (const std::string &logFile, const std::string &errFile, Level logLevel=Level::INFO, Level errFileLevel=Level::WARN)
 Initializes logging, sets the path to the file for logging, to the file for outputting errors and warnings, and sets the logging level for both files.
 

Detailed Description

A class of utility methods for managing the logging mechanism.

Member Enumeration Documentation

◆ Level

enum class Logging::Level
strong

Defines a set of standard logging levels that can be used to control logging output.

Enumerator
ALL 

Indicates that all messages should be logged.

TRACE 

Indicates a highly detailed tracing message.

DEBUG 

Is a message level providing tracing debug information.

INFO 

Is a message level for informational messages.

WARN 

Is a message level indicating a potential problem.

ERROR 

Is a message level indicating a serious failure.

OFF 

Is a special level that can be used to turn off logging.

Member Function Documentation

◆ init() [1/3]

void Logging::init ( const std::string & logFile,
const std::string & errFile,
Level logLevel = Level::INFO,
Level errFileLevel = Level::WARN )
static

Initializes logging, sets the path to the file for logging, to the file for outputting errors and warnings, and sets the logging level for both files.

This is equivalent to the following code:

System::setProperty("log.className", "com.devexperts.logging.InterceptableLogging");
System::setProperty("log.file", logFile);
System::setProperty("log.level", levelToString(logLevel));
System::setProperty("err.file", errFile);
System::setProperty("err.level", levelToString(errFileLevel));
static std::string levelToString(Level level)
Converts enum Level values to their string representation.
Definition Logging.cpp:16
static bool setProperty(const std::string &key, const std::string &value)
Sets the JVM system property indicated by the specified key.
Definition System.cpp:18
Parameters
logFileThe logging file.
errFileThe err file.
logLevelThe logging level.
errFileLevelThe err file logging level.

References levelToString(), and System::setProperty().

◆ init() [2/3]

void Logging::init ( const std::string & logFile,
Level logLevel = Level::INFO )
static

Initializes logging, sets the path to the logging file and the logging level.

This is equivalent to the following code:

System::setProperty("log.className", "com.devexperts.logging.InterceptableLogging");
System::setProperty("log.file", logFile);
System::setProperty("log.level", levelToString(logLevel));
Parameters
logFileThe logging file.
logLevelThe logging level.

References levelToString(), and System::setProperty().

◆ init() [3/3]

void Logging::init ( Level level = Level::OFF)
static

Initializes logging and sets the logging level.

This is equivalent to the following code:

System::setProperty("log.className", "com.devexperts.logging.InterceptableLogging");
System::setProperty("log.level", levelToString(level));
System::setProperty("err.level", levelToString(level));
Parameters
levelThe logging level.

References levelToString(), and System::setProperty().

◆ levelToString()

DXFCPP_BEGIN_NAMESPACE std::string Logging::levelToString ( Level level)
static

Converts enum Level values to their string representation.

Parameters
levelThe enum Level value.
Returns
The string representation.

References ALL, DEBUG, ERROR, INFO, OFF, TRACE, and WARN.

Referenced by init(), init(), and init().