iopccommon/trace.h File Reference

LogWriter singleton and logging/tracing/debugging macros. More...

#include <fstream>
#include <ostream>
#include <string>
#include "defs.h"
#include "mutex.h"
#include <cstdlib>

Namespaces

namespace  iopc

Classes

class  iopc::LogWriter
 A LogWriter singleton is used to log messages for the IOPC 2 library or user application. More...


Detailed Description

LogWriter singleton and logging/tracing/debugging macros.

Author:
Michal Kopecky

Jan Hadrava

Petr Cermak

IOPC_DEBUG macro enables or disables all debugging messages IOPC_TRACE macro enables or disables all tracing messages. Release versions of IOPC 2 should have these macros undefined.

The logging macros can be used in the following way:

 IOPC_DEBUG macros (if IOPC_DEBUG is undefined, no messages are logged):
 IOPC_DEBUGLOG(msg)

 IOPC_TRACE macros (if IOPC_TRACE is undefined, no messages are logged):
 void func() {
        IOPC_FUNC_INVOKED;
         ..
        IOPC_FUNC_ENDED;
        or
        IOPC_FUNC_END(string retval)
 }

 IOPC_LOG_THROW(IopcDbException("error"))

 IOPC_LOG_CATCH(IopcException& exc)
        IOPC_LOG_THROW(exc);
 IOPC_LOG_CATCH_NEXT(...)
        IOPC_UNREACHABLE;
 IOPC_LOG_CAUGHT

 Always logging macros:
 IOPC_ASSERT(cond); // Exits program if condition evaluates to false
 IOPC_UNREACHABLE;  // Exists program if reached

Generated on Tue Apr 14 16:46:23 2009 for IOPC 2 by  doxygen 1.5.6