C++ Based OPC UA Client/Server/PubSub SDK  1.8.3.628

A class used for trace outputs (error, information,...). More...

#include <uatrace.h>

Inheritance diagram for UaTrace:
SrvT

Public Types

enum  TraceLevel {
  NoTrace = 0 , Errors , Warning , Info ,
  InterfaceCall , CtorDtor , ProgramFlow , Data
}
 Definition of the TraceLevel Enumeration. More...
 

Public Member Functions

 UaTrace ()
 construction
 
virtual ~UaTrace ()
 destruction
 

Static Public Member Functions

static long initTrace (TraceLevel traceLevel, unsigned int maxTraceEntries, unsigned int NumBackupFiles, const UaString &traceFile, const UaString &appName)
 Initialize the trace.
 
static long changeTrace (TraceLevel traceLevel, unsigned int maxTraceEntries, unsigned int NumBackupFiles, const UaString &traceFile)
 Change the trace settings.
 
static long initErrorTrace (const UaString &traceFile, const UaString &appName)
 Initialize the trace.
 
static void setPreFileTrace (bool isActive, TraceLevel traceLevel)
 Provides a string buffer trace before a trace file is created.
 
static long setProductVersion (const UaString &appVersion)
 Get the trace level.
 
static TraceLevel getTraceLevel ()
 Get the trace level.
 
static UaString getTraceFilePath ()
 Get the path of the trace file.
 
static void setLocalTimeOutput (bool isLocal)
 Set time output for trace to local time.
 
static void setPrintDateInTrace (bool printDateInTrace)
 Set time output for trace to print also the date.
 
static void setTraceHook (UaTraceHook *pTraceHook)
 Set a trace hook for all trace messages passing the configured trace level.
 
static void setErrorTraceHook (UaTraceHook *pErrorTraceHook)
 Set a trace hook for all error, warning and info trace messages This hook is set by the SDK and intended for internal use only.
 
static void tError (const char *fmt,...)
 Error trace output.
 
static void tWarning (const char *fmt,...)
 Warning trace output.
 
static void tInfo (const char *fmt,...)
 Info trace output.
 
static void tIfCall (const char *fmt,...)
 External interface call trace output.
 
static void tCtor (const char *fmt,...)
 Ctor and Dtor trace output.
 
static void tInOut (const char *fmt,...)
 Program flow trace output.
 
static void tData (const char *fmt,...)
 Data trace output.
 
static void flushTrace ()
 Write any data from the file buffer to the physical file.
 
static void closeTrace ()
 Close trace file.
 
static bool isInitialized ()
 Returns the information if the trace is already initialized.
 
static bool isPreFileTraceActive ()
 Get PreFileTrace active state.
 
static std::list< UaStringgetPreFileTraces ()
 Returns the list of pre file trace outputs.
 
static void clearPreFileTraces ()
 Clear the list of pre file trace outputs.
 
static void setMaxPreFileTraceEntries (unsigned int nMaxPreFileTraceEntries)
 Returns the list of pre file trace outputs.
 

Static Protected Member Functions

static void trace (TraceLevel traceLevel, const char *fmt, va_list arg_ptr)
 File trace output preparation.
 
static void traceOutput (TraceLevel traceLevel, const char *sContent, int nModule=0, bool bFromUaStack=false)
 File trace output.
 

Detailed Description

A class used for trace outputs (error, information,...).

Member Enumeration Documentation

◆ TraceLevel

Definition of the TraceLevel Enumeration.

Enumerator
NoTrace 

Trace_Level: No Trace

Errors 

Trace_Level: Unexpected errors

Warning 

Trace_Level: Unexpected behaviour that is not an error

Info 

Trace_Level: Information about important activities like connection establishment

InterfaceCall 

Trace_Level: Calls to module interfaces

CtorDtor 

Trace_Level: Creation and destruction of objects

ProgramFlow 

Trace_Level: Internal program flow

Data 

Trace_Level: Data

Member Function Documentation

◆ changeTrace()

long UaTrace::changeTrace ( TraceLevel  traceLevel,
unsigned int  maxTraceEntries,
unsigned int  NumBackupFiles,
const UaString traceFile 
)
static

Change the trace settings.

Parameters
traceLevelthe actual trace level.
maxTraceEntriesthe maximum number of trace entries.
NumBackupFilesthe number of all backup files.
traceFilethe file where the trace will be printed in.
Returns
the trace settings.

◆ getTraceFilePath()

UaString UaTrace::getTraceFilePath ( )
static

Get the path of the trace file.

Returns
the file where the trace will be printed out.

◆ getTraceLevel()

UaTrace::TraceLevel UaTrace::getTraceLevel ( )
static

Get the trace level.

Returns
the trace level.

◆ initErrorTrace()

long UaTrace::initErrorTrace ( const UaString traceFile,
const UaString appName 
)
static

Initialize the trace.

Parameters
traceFilethe file where the trace will be printed in.
appNamethe application name.
Returns
the initialized error trace.

◆ initTrace()

long UaTrace::initTrace ( TraceLevel  traceLevel,
unsigned int  maxTraceEntries,
unsigned int  NumBackupFiles,
const UaString traceFile,
const UaString appName 
)
static

Initialize the trace.

Parameters
traceLevelthe actual trace level.
maxTraceEntriesthe maximum of trace entries.
NumBackupFilesthe number of all backup files.
traceFilethe file where the trace will be printed out.
appNamethe application name.
Returns
the initialized trace.

◆ isPreFileTraceActive()

bool UaTrace::isPreFileTraceActive ( )
static

Get PreFileTrace active state.

Returns
TRUE if active FALSE if not.

◆ setErrorTraceHook()

void UaTrace::setErrorTraceHook ( UaTraceHook pErrorTraceHook)
static

Set a trace hook for all error, warning and info trace messages This hook is set by the SDK and intended for internal use only.

If you want to implement your own trace just use setTraceHook(UaTraceHook* pTraceHook).

Parameters
pErrorTraceHookInterface pointer for the trace hook.

◆ setLocalTimeOutput()

void UaTrace::setLocalTimeOutput ( bool  isLocal)
static

Set time output for trace to local time.

Parameters
isLocaltrue if local false if not.

◆ setMaxPreFileTraceEntries()

void UaTrace::setMaxPreFileTraceEntries ( unsigned int  nMaxPreFileTraceEntries)
static

Returns the list of pre file trace outputs.

Parameters
nMaxPreFileTraceEntriesthe new setting for .

◆ setPreFileTrace()

void UaTrace::setPreFileTrace ( bool  isActive,
TraceLevel  traceLevel 
)
static

Provides a string buffer trace before a trace file is created.

This can be used to activate a trace before the configuration with the file settings is loaded.

Parameters
isActiveThe active setting for the pre file trace.
traceLevelThe actual trace level to use for the pre file trace.

◆ setPrintDateInTrace()

void UaTrace::setPrintDateInTrace ( bool  printDateInTrace)
static

Set time output for trace to print also the date.

Parameters
printDateInTracetrue if print date in trace false if not.

◆ setProductVersion()

long UaTrace::setProductVersion ( const UaString productVersion)
static

Get the trace level.

Returns
the trace level.

◆ setTraceHook()

void UaTrace::setTraceHook ( UaTraceHook pTraceHook)
static

Set a trace hook for all trace messages passing the configured trace level.

Parameters
pTraceHookInterface pointer for the trace hook.

◆ tCtor()

void UaTrace::tCtor ( const char *  fmt,
  ... 
)
static

Ctor and Dtor trace output.

Parameters
fmtthe message to be printed out

◆ tData()

void UaTrace::tData ( const char *  fmt,
  ... 
)
static

Data trace output.

Parameters
fmtthe message to be printed out

◆ tError()

void UaTrace::tError ( const char *  fmt,
  ... 
)
static

Error trace output.

Parameters
fmtthe message to be printed out

◆ tIfCall()

void UaTrace::tIfCall ( const char *  fmt,
  ... 
)
static

External interface call trace output.

Parameters
fmtthe message to be printed out

◆ tInfo()

void UaTrace::tInfo ( const char *  fmt,
  ... 
)
static

Info trace output.

Parameters
fmtthe message to be printed out

◆ tInOut()

void UaTrace::tInOut ( const char *  fmt,
  ... 
)
static

Program flow trace output.

Parameters
fmtthe message to be printed out

◆ trace()

void UaTrace::trace ( TraceLevel  traceLevel,
const char *  fmt,
va_list  arg_ptr 
)
staticprotected

File trace output preparation.

Parameters
traceLevelthe actual trace level.
fmtthe message to be printed out
arg_ptra pointer to the arguments.

◆ traceOutput()

void UaTrace::traceOutput ( TraceLevel  traceLevel,
const char *  sContent,
int  nModule = 0,
bool  bFromUaStack = false 
)
staticprotected

File trace output.

Parameters
traceLevelthe actual trace level.
sContentthe message to be printed out
nModulethe module printing the message.
bFromUaStacka flag indicating if the message is from the stack.

◆ tWarning()

void UaTrace::tWarning ( const char *  fmt,
  ... 
)
static

Warning trace output.

Parameters
fmtthe message to be printed out

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