libdali 1.8.0
The DataLink client library
Loading...
Searching...
No Matches
Data Structures | Functions
Central Logging

Central logging functions for the library and calling programs. More...

Data Structures

struct  DLLog
 

Functions

int dl_log (int level, int verb, const char *format,...)
 Log a message using the global logging parameters.
 
int dl_log_r (const DLCP *dlconn, int level, int verb, const char *format,...)
 Log a message using the log parameters from a DLCP.
 
int dl_log_rl (DLLog *log, int level, int verb, const char *format,...)
 Log a message using the log parameters from a DLCP.
 
void dl_loginit (int verbosity, void(*log_print)(char *), const char *logprefix, void(*diag_print)(char *), const char *errprefix)
 Initialize global logging system parameters.
 
void dl_loginit_r (DLCP *dlconn, int verbosity, void(*log_print)(char *), const char *logprefix, void(*diag_print)(char *), const char *errprefix)
 Initialize logging parameters specific to a DLCP.
 
DLLogdl_loginit_rl (DLLog *log, int verbosity, void(*log_print)(char *), const char *logprefix, void(*diag_print)(char *), const char *errprefix)
 Initialize logging parameters for a specific DLLog.
 

Detailed Description

Central logging functions for the library and calling programs.

This central logging facility is used for all logging performed by the library.

The logging can be configured to send messages to arbitrary functions, referred to as log_print() and diag_print(). This allows output to be re-directed to other logging systems if needed.

It is also possible to assign prefixes to log messages for identification, referred to as logprefix and errprefix.

Three message levels are recognized:

It is the task of the ms_log() and ms_log_l() functions to format a message using printf conventions and pass the formatted string to the appropriate printing function.

Function Documentation

◆ dl_log()

int dl_log ( int  level,
int  verb,
const char *  format,
  ... 
)

Log a message using the global logging parameters.

A wrapper to dl_log_main() that uses the global logging parameters.

Parameters
levelLevel at which to log the message (1, 2 or 3)
verbVerbosity threshold at which to log the message
formatMessage format in printf() style
...Message format variables
Returns
See dl_log_main() description for return values.

◆ dl_log_r()

int dl_log_r ( const DLCP dlconn,
int  level,
int  verb,
const char *  format,
  ... 
)

Log a message using the log parameters from a DLCP.

A wrapper to dl_log_main() that uses the logging parameters in a supplied DLCP. If the supplied pointer is NULL the global logging parameters will be used.

Parameters
dlconnDataLink Connection Parameters with associated logging paramters
levelLevel at which to log the message (1, 2 or 3)
verbVerbosity threshold at which to log the message
formatMessage format in printf() style
...Message format variables
Returns
See dl_log_main() description for return values.

◆ dl_log_rl()

int dl_log_rl ( DLLog log,
int  level,
int  verb,
const char *  format,
  ... 
)

Log a message using the log parameters from a DLCP.

A wrapper to dl_log_main() that uses the logging parameters in a supplied DLLog. If the supplied pointer is NULL the global logging parameters will be used.

Parameters
logDLLog logging paramters
levelLevel at which to log the message (1, 2 or 3)
verbVerbosity threshold at which to log the message
formatMessage format in printf() style
...Message format variables
Returns
See dl_log_main() description for return values.

◆ dl_loginit()

void dl_loginit ( int  verbosity,
void(*)(char *)  log_print,
const char *  logprefix,
void(*)(char *)  diag_print,
const char *  errprefix 
)

Initialize global logging system parameters.

Initialize the global logging parameters.

See dl_loginit_main() description for usage.

◆ dl_loginit_r()

void dl_loginit_r ( DLCP dlconn,
int  verbosity,
void(*)(char *)  log_print,
const char *  logprefix,
void(*)(char *)  diag_print,
const char *  errprefix 
)

Initialize logging parameters specific to a DLCP.

Initialize DLCP specific logging parameters. If the logging parameters have not been initialized (dlconn->log == NULL) new parameter space will be allocated.

See dl_loginit_main() description for usage.

◆ dl_loginit_rl()

DLLog * dl_loginit_rl ( DLLog log,
int  verbosity,
void(*)(char *)  log_print,
const char *  logprefix,
void(*)(char *)  diag_print,
const char *  errprefix 
)

Initialize logging parameters for a specific DLLog.

Initialize DLLog specific logging parameters. If the logging parameters have not been initialized (log == NULL) new parameter space will be allocated.

See dl_loginit_main() description for usage.

Returns
A pointer to the created/re-initialized DLLog struct.