libdas2
das2 core C utilities
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Macros | Functions
log.h File Reference

Simple message logging. More...

Detailed Description

Simple message logging.

Generic thread safe logging. By default messages are simply printed to standard error, use das_log_sethandler() to send messages some where else. All log messages are sent via das_log(), however the following convience macros make for less typing:

For example a log line such as:

* das_warn_v("File %s, Pkt %05d: Header Block > 256 bytes", sFile, nIdx);
*

is equivalent to:

* das_log(DAS_LL_WARN, __FILE__, __LINE__,
* "File %s, Pkt %05d: Header Block > 256 bytes", sFile, nIdx);
*

but shorter.

#include <das2/util.h>

Go to the source code of this file.

Macros

#define daslog_trace(M)   daslog(DASLOG_TRACE, __FILE__, __LINE__, M)
 Macro wrapper around das_log() for TRACE messages with out variable args.
 
#define daslog_debug(M)   daslog(DASLOG_DEBUG, __FILE__, __LINE__, M)
 Macro wrapper around das_log() for DEBUG messages with out variable args.
 
#define daslog_info(M)   daslog(DASLOG_INFO, __FILE__, __LINE__, M)
 Macro wrapper around das_log() for INFO messages with out variable args.
 
#define daslog_warn(M)   daslog(DASLOG_WARN, __FILE__, __LINE__, M)
 Macro wrapper around das_log() for WARNING messages with out variable args.
 
#define daslog_error(M)   daslog(DASLOG_ERROR, __FILE__, __LINE__, M)
 Macro wrapper around das_log() for ERROR messages with out variable args.
 
#define daslog_critical(M)   daslog(DAS_LL_CRITICAL, __FILE__, __LINE__, M)
 Macro wrapper around das_log() for CRITICAL messages with out variable args.
 
#define daslog_trace_v(F,...)   daslog(DASLOG_TRACE, __FILE__, __LINE__, F, __VA_ARGS__)
 Macro wrapper around das_log() for TRACE messages with variable arguments.
 
#define daslog_debug_v(F,...)   daslog(DASLOG_DEBUG, __FILE__, __LINE__, F, __VA_ARGS__)
 Macro wrapper around das_log() for DEBUG messages with variable arguments.
 
#define daslog_info_v(F,...)   daslog(DASLOG_INFO, __FILE__, __LINE__, F, __VA_ARGS__)
 Macro wrapper around das_log() for INFO messages with variable arguments.
 
#define daslog_warn_v(F,...)   daslog(DASLOG_WARN, __FILE__, __LINE__, F, __VA_ARGS__)
 Macro wrapper around das_log() for WARNING messages with variable arguments.
 
#define daslog_error_v(F,...)   daslog(DASLOG_ERROR, __FILE__, __LINE__, F, __VA_ARGS__)
 Macro wrapper around das_log() for ERROR messages with variable arguments.
 
#define daslog_critical_v(F,...)   daslog(DASLOG_CRIT, __FILE__, __LINE__, F, __VA_ARGS__)
 Macro wrapper around das_log() for CRITICAL messages with variable arguments.
 

Functions

int daslog_level (void)
 Get the log level. More...
 
int daslog_setlevel (int nLevel)
 Set the logging level for this thread. More...
 
bool daslog_set_showline (int nLevel)
 Output source file and line numbers for messages at or above this level.
 
das_log_handler_t daslog_sethandler (das_log_handler_t new_handler)
 Install a new message handler function for this thread. More...