Remote Call Framework 3.4
Appendix - Logging

RCF has a configurable logging subsystem which can be controlled through the RCF::enableLogging() and RCF::disableLogging() functions. To use these functions, you will need to include the <RCF/Log.hpp> header.

By default, logging is disabled. To enable logging, call RCF::enableLogging(). RCF::enableLogging() takes two optional parameters, allowing you to specify log level and log target.

// Using default values for log target and log level.
// Using custom values for log target and log level.
int logLevel = 2;
RCF::enableLogging(RCF::LogToDebugWindow(), logLevel);

The log level can range from 0 (no logging at all) to 4 (verbose logging). The default log level is 2.

The log target parameter can be one of the following:

Log target Log output location
RCF::LogToDebugWindow() Windows only. Log output appears in Visual Studio debug output window.
RCF::LogToStdout() Log output appears on standard output.
RCF::LogToFile(const std::string & logFilePath) Log output appears in the nominated file.
RCF::LogToFunc(std::function<void(const RCF::ByteBuffer &)>) Log output is passed to a user-defined function.

On Windows platforms, the default log target is RCF::LogToDebugWindow.

On non-Windows platforms, the default log target is RCF::LogToStdout.

Finally, to disable logging, call RCF::disableLogging():

// Disable logging.

RCF::enableLogging() and RCF::disableLogging() are internally threadsafe and can be called by multiple threads concurrently.