libyui
Public Member Functions | Static Public Member Functions

YUILog Class Reference

#include <YUILog.h>

List of all members.

Public Member Functions

std::ostream & log (YUILogLevel_t logLevel, const char *logComponent, const char *sourceFileName, int lineNo, const char *functionName)

Static Public Member Functions

static std::ostream & debug (const char *logComponent, const char *sourceFileName, int lineNo, const char *functionName)
static std::ostream & milestone (const char *logComponent, const char *sourceFileName, int lineNo, const char *functionName)
static std::ostream & warning (const char *logComponent, const char *sourceFileName, int lineNo, const char *functionName)
static std::ostream & error (const char *logComponent, const char *sourceFileName, int lineNo, const char *functionName)
static YUILoginstance ()
static void enableDebugLogging (bool debugLogging=true)
static bool debugLoggingEnabled ()
static bool setLogFileName (const string &logFileName)
static string logFileName ()
static void setLoggerFunction (YUILoggerFunction loggerFunction)
static YUILoggerFunction loggerFunction (bool returnStdLogger=false)
static void setEnableDebugLoggingHooks (YUIEnableDebugLoggingFunction enableFunction, YUIDebugLoggingEnabledFunction isEnabledFunction)
static
YUIEnableDebugLoggingFunction 
enableDebugLoggingHook ()
static
YUIDebugLoggingEnabledFunction 
debugLoggingEnabledHook ()
static string basename (const string &fileNameWithPath)

Detailed Description

UI logging.


Member Function Documentation

string YUILog::basename ( const string &  fileNameWithPath) [static]

Return the base name without path from a file name with path.

ostream & YUILog::debug ( const char *  logComponent,
const char *  sourceFileName,
int  lineNo,
const char *  functionName 
) [static]

Logging functions for each log level. They all access the singleton object for this class. This means that the first call to any of those functions will create the singleton YUILog object.

bool YUILog::debugLoggingEnabled ( ) [static]

Return 'true' if debug logging is enabled, 'false' if not.

YUIDebugLoggingEnabledFunction YUILog::debugLoggingEnabledHook ( ) [static]

Return the hook function that checks if debug logging is enabled or 0 if no such hook function is set.

void YUILog::enableDebugLogging ( bool  debugLogging = true) [static]

Enable or disable debug logging.

YUIEnableDebugLoggingFunction YUILog::enableDebugLoggingHook ( ) [static]

Return the hook function that enables or disables debug logging or 0 if no such hook function is set.

YUILog * YUILog::instance ( ) [static]

Return the singleton object for this class. This will create the singleton if it doesn't exist yet.

ostream & YUILog::log ( YUILogLevel_t  logLevel,
const char *  logComponent,
const char *  sourceFileName,
int  lineNo,
const char *  functionName 
)

Generic log function. debug(), milestone() etc. ultimately all call this function.

string YUILog::logFileName ( ) [static]

Return the current log file name or an empty string if stderr is used. Notice that this information is only relevant as long as the standard logger function is used.

YUILoggerFunction YUILog::loggerFunction ( bool  returnStdLogger = false) [static]

Return the UI logger function.

If stderr is used for logging (i.e. no logger function set), 0 is returned (unless 'returnStdLogger' is 'true', in which case the internally used stderr-logger is returned).

void YUILog::setEnableDebugLoggingHooks ( YUIEnableDebugLoggingFunction  enableFunction,
YUIDebugLoggingEnabledFunction  isEnabledFunction 
) [static]

Set the hook functions to enable/disable debug logging and to query if debug logging is enabled:

void enableDebugLogging( bool enable ); bool debugLoggingEnabled();

If those functions are set, they will be used instead of the internal "debugLogging" flag.

bool YUILog::setLogFileName ( const string &  logFileName) [static]

Set the log file name to be used with the standard logger function. Output will be appended to this file.

Until this file name is set, the standard logger function logs to stderr. Set the log file name to an empty string to log to stderr again.

This returns 'true' upon success (opening the file was successful), 'false' upon error.

Notice:

(1) This file name is only relevant as long as the standard logger function is used. Custom logger functions may or may not use this file name.

(2) No attempt is made to do anything fancy with the log file like log file rotation when a certain file size is reached. Applications that need this should use a custom logger function. See also setLoggerFunction().

void YUILog::setLoggerFunction ( YUILoggerFunction  loggerFunction) [static]

Set the UI logger function. This is the function that will ultimately receive all UI log output (except debug logging if debug logging is disabled).

By default, all logging is output to stderr. This behaviour can be restored if 0 is passed as a function pointer here.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations Friends