OpenZWave::Log Class Reference

Implements a platform-independent log...written to the console and, optionally, a file. More...

`#include <Log.h>`

## Static Public Member Functions

static Log * | Create (string const &_filename, bool const _bAppend, bool const _bConsoleOutput, LogLevel const _saveLevel, LogLevel const _queueLevel, LogLevel const _dumpTrigger)
static Log * | Create (i_LogImpl *LogClass)
static void | Destroy ()
static bool | SetLoggingClass (i_LogImpl *LogClass)
| Set the Logging Implementation Class to replace the standard File/Console logging. More...
static void | SetLoggingState (bool _dologging)
| Enable or disable library logging (retained for backward compatibility) More...
static void | SetLoggingState (LogLevel _saveLevel, LogLevel _queueLevel, LogLevel _dumpTrigger)
| Enable or disable library logging. To disable, set _saveLevel and _queueLevel to LogLevel_None. More...
static bool | GetLoggingState ()
| Determine whether logging is enabled or not (retained for backward compatibility) More...
static void | GetLoggingState (LogLevel *_saveLevel, LogLevel *_queueLevel, LogLevel *_dumpTrigger)
| Obtain the various logging levels. More...
static void | SetLogFileName (const string &_filename)
| Change the log file name. This will start a new log file (or potentially start appending information to an existing one. Developers might want to use this function, together with a timer in the controlling application, to create timestamped log file names. More...
static void | Write (LogLevel _level, char const *_format,...)
static void | Write (LogLevel _level, uint8 const _nodeId, char const *_format,...)
static void | QueueDump ()
static void | QueueClear ()

## Detailed Description

Implements a platform-independent log...written to the console and, optionally, a file.

## Member Function Documentation

## Create() [1/2]

Log * Log::Create | ( | string const & | _filename,
|  | bool const | _bAppend,
|  | bool const | _bConsoleOutput,
|  | LogLevel const | _saveLevel,
|  | LogLevel const | _queueLevel,
|  | LogLevel const | _dumpTrigger
| ) |  |

static

Create a log. Creates the cross-platform logging singleton. Any previous log will be cleared.

Returns
  a pointer to the logging object.

See also
  Destroy, Write

## Create() [2/2]

static Log* OpenZWave::Log::Create | ( | i_LogImpl * | LogClass | ) |

static

Create a log. Creates the cross-platform logging singleton. Any previous log will be cleared.

Parameters

  LogClass | a Logging Class that inherits the i_LogImpl Class to use to Log

Returns
  a pointer to the logging object.

See also
  Destroy, Write

## Destroy()

void Log::Destroy | ( |  | ) |

static

Destroys the log. Destroys the logging singleton. The log can no longer be written to without another call to Create.

See also
  Create, Write

## GetLoggingState() [1/2]

bool Log::GetLoggingState | ( |  | ) |

static

Determine whether logging is enabled or not (retained for backward compatibility)

Parameters

  _dologging | If true, logging is enabled; if false, disabled

## GetLoggingState() [2/2]

static void OpenZWave::Log::GetLoggingState | ( | LogLevel * | _saveLevel,
|  | LogLevel * | _queueLevel,
|  | LogLevel * | _dumpTrigger
| ) |  |

static

Obtain the various logging levels.

Parameters

  _saveLevel | LogLevel of messages to write in real-time
  _queueLevel | LogLevel of messages to queue to be dumped in case of an error
  _dumpTrigger | LogLevel of message that triggers a queue dump (probably LogLevel_Error or LogLevel_Warning)

## QueueClear()

void Log::QueueClear | ( |  | ) |

static

Clear the log message queue

## QueueDump()

void Log::QueueDump | ( |  | ) |

static

Send the queued log messages to the log output.

## SetLogFileName()

void Log::SetLogFileName | ( | const string & | _filename | ) |

static

Change the log file name. This will start a new log file (or potentially start appending information to an existing one. Developers might want to use this function, together with a timer in the controlling application, to create timestamped log file names.

Parameters

  _filename | Name of the new (or existing) file to use for log output.

## SetLoggingClass()

bool Log::SetLoggingClass | ( | i_LogImpl * | LogClass | ) |

static

Set the Logging Implementation Class to replace the standard File/Console logging.

Parameters

  LogClass | A Logging Class that inherits the i_LogImpl Class used to Log to

Returns
  Bool Value indicating success or failure

## SetLoggingState() [1/2]

void Log::SetLoggingState | ( | bool | _dologging | ) |

static

Enable or disable library logging (retained for backward compatibility)

Parameters

  _dologging | If true, logging is enabled; if false, disabled

## SetLoggingState() [2/2]

void Log::SetLoggingState | ( | LogLevel | _saveLevel,
|  | LogLevel | _queueLevel,
|  | LogLevel | _dumpTrigger
| ) |  |

static

Enable or disable library logging. To disable, set _saveLevel and _queueLevel to LogLevel_None.

Parameters

  _saveLevel | LogLevel of messages to write in real-time
  _queueLevel | LogLevel of messages to queue to be dumped in case of an error
  _dumpTrigger | LogLevel of message that triggers a queue dump (probably LogLevel_Error or LogLevel_Warning)

## Write() [1/2]

void Log::Write | ( | LogLevel | _level,
|  | char const * | _format,
|  |  | ...
| ) |  |

static

Write an entry to the log. Writes a formatted string to the log.

Parameters

  _level | Specifies the type of log message (Error, Warning, Debug, etc.)
  _format. | A string formatted in the same manner as used with printf etc.
  ... | a variable number of arguments, to be included in the formatted string.

See also
  Create, Destroy

## Write() [2/2]

void Log::Write | ( | LogLevel | _level,
|  | uint8 const | _nodeId,
|  | char const * | _format,
|  |  | ...
| ) |  |

static

Write an entry to the log. Writes a formatted string to the log.

Parameters

  _level | Specifies the type of log message (Error, Warning, Debug, etc.)
  _nodeId | Node Id this entry is about.
  _format. | A string formatted in the same manner as used with printf etc.
  ... | a variable number of arguments, to be included in the formatted string.

See also
  Create, Destroy

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

- Log.h
- Log.cpp