You.i Engine
CYILogger Class Reference

Detailed Description

The logging class reports messages to the programmer via a policy.

The logging class defaults to the console logging policy, which means that information is redirected to the systems console, if available. For Windows, the default console is the default command shell; note that for some programs, the program output should be redirected to a file as reporting may happen through other temporary shells created by the application.

When logging on the Android platform, the CYIAndroidPolicy class will be used by default.

When logging on an Apple platform, the CYIApplePolicy class will be used by default.

#include <logging/YiLogger.h>

Public Member Functions

 CYILogger ()
 
 CYILogger (const char *pModuleName, const char *pPrettyFunction, uint32_t unLineNumber, const CYIString &rTagName, YI_LOG_SEVERITY eSeverity, const char *pLogMessage,...)
 
 CYILogger (const char *pModuleName, const char *pPrettyFunction, uint32_t unLineNumber, const CYIString &rTagName, YI_LOG_SEVERITY eSeverity, const char *pLogMessage, va_list varArgPtr)
 
 CYILogger (const char *pModuleName, const char *pPrettyFunction, uint32_t unLineNumber, const std::string &rTagName, YI_LOG_SEVERITY eSeverity, const char *pLogMessage, va_list varArgPtr)
 
 CYILogger (const char *pModuleName, const char *pPrettyFunction, uint32_t unLineNumber, const char *pTagName, YI_LOG_SEVERITY eSeverity, const char *pLogMessage, va_list varArgPtr)
 
 ~CYILogger ()
 

Static Public Member Functions

static std::shared_ptr< CYILogPolicyCreateDefaultLogPolicy ()
 
static void SetLogPolicy (const std::shared_ptr< CYILogPolicy > &pPolicy)
 
static const std::shared_ptr< CYILogPolicy > & GetLogPolicy ()
 
static const std::shared_ptr< CYIPreferences > & GetPreferences ()
 
static void SetPreferences (const std::shared_ptr< CYIPreferences > &pPrefs)
 
static void SetLoggingEnabled (bool bEnabled)
 

Friends

class CYILoggerPriv
 

Constructor & Destructor Documentation

CYILogger::CYILogger ( )

Default constructor; use this constructor to configure the logger.

CYILogger::CYILogger ( const char *  pModuleName,
const char *  pPrettyFunction,
uint32_t  unLineNumber,
const CYIString rTagName,
YI_LOG_SEVERITY  eSeverity,
const char *  pLogMessage,
  ... 
)

Overloaded constructor used by the YI_LOG* macros.

CYILogger::CYILogger ( const char *  pModuleName,
const char *  pPrettyFunction,
uint32_t  unLineNumber,
const CYIString rTagName,
YI_LOG_SEVERITY  eSeverity,
const char *  pLogMessage,
va_list  varArgPtr 
)

Overloaded constructor used by the YI_LOG* macros.

CYILogger::CYILogger ( const char *  pModuleName,
const char *  pPrettyFunction,
uint32_t  unLineNumber,
const std::string &  rTagName,
YI_LOG_SEVERITY  eSeverity,
const char *  pLogMessage,
va_list  varArgPtr 
)

Overloaded constructor used by the YI_LOG* macros.

CYILogger::CYILogger ( const char *  pModuleName,
const char *  pPrettyFunction,
uint32_t  unLineNumber,
const char *  pTagName,
YI_LOG_SEVERITY  eSeverity,
const char *  pLogMessage,
va_list  varArgPtr 
)

Overloaded constructor used by the YI_LOG* macros.

Note
The pTagName string is assumed to be a static const char array. The behaviour of this function is undefined if a non-const or a non-static char array is passed to this function.
CYILogger::~CYILogger ( )

Destructor.

Member Function Documentation

static std::shared_ptr<CYILogPolicy> CYILogger::CreateDefaultLogPolicy ( )
static
static const std::shared_ptr<CYILogPolicy>& CYILogger::GetLogPolicy ( )
static

Returns the currently-assigned log policy.

static const std::shared_ptr<CYIPreferences>& CYILogger::GetPreferences ( )
static

Returns the current set of preferences.

static void CYILogger::SetLoggingEnabled ( bool  bEnabled)
static

Enables or disables the logging service.

Note
Any custom log policy set via CYILogger::SetLogPolicy will be removed when disabling the logger via this API. The custom policy must be reset after re-enabling the logger via this API.
static void CYILogger::SetLogPolicy ( const std::shared_ptr< CYILogPolicy > &  pPolicy)
static

Set the log policy, pPolicy, to use with this logger.

Note
A null pPolicy is not permitted, to disable logging use CYILogger::SetLoggingEnabled.
static void CYILogger::SetPreferences ( const std::shared_ptr< CYIPreferences > &  pPrefs)
static

Accepts a new set of preferences for logging.

See CYILogPolicy class documentation for further detail regarding logging preferences.

Note
If pPrefs was constructed with bWatchFile set to true and a valid config file path, then on some platforms, the application will continually poll for changes in the file to reload the logging preferences.
See also
CYIPreferences::IsWatchingFile

Friends And Related Function Documentation

friend class CYILoggerPriv
friend

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