pcsc-lite 2.3.0
debuglog.h File Reference

This handles debugging. More...

Go to the source code of this file.

Macros

#define PCSC_API
 
#define DEBUG_CATEGORY_NOTHING   0
 
#define DEBUG_CATEGORY_APDU   1
 
#define DEBUG_CATEGORY_SW   2
 
#define __FUNCTION__   ""
 
#define __attribute__(x)   /*nothing*/
 
#define Log0(priority)   log_msg(priority, "%s:%d:%s()", __FILE__, __LINE__, __FUNCTION__)
 
#define Log1(priority, fmt)   log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__)
 
#define Log2(priority, fmt, data)   log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data)
 
#define Log3(priority, fmt, data1, data2)   log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2)
 
#define Log4(priority, fmt, data1, data2, data3)   log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3)
 
#define LogRv4(priority, rv, fmt, data1, data2)   log_msg_rv(priority, rv, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2)
 
#define Log5(priority, fmt, data1, data2, data3, data4)   log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3, data4)
 
#define Log9(priority, fmt, data1, data2, data3, data4, data5, data6, data7, data8)   log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3, data4, data5, data6, data7, data8)
 
#define LogXxd(priority, msg, buffer, size)   log_xxd(priority, msg, buffer, size)
 
#define DebugLogA(a)   Log1(PCSC_LOG_INFO, a)
 
#define DebugLogB(a, b)   Log2(PCSC_LOG_INFO, a, b)
 
#define DebugLogC(a, b, c)   Log3(PCSC_LOG_INFO, a, b, c)
 

Enumerations

enum  {
  DEBUGLOG_NO_DEBUG = 0 ,
  DEBUGLOG_SYSLOG_DEBUG ,
  DEBUGLOG_STDOUT_DEBUG ,
  DEBUGLOG_STDOUT_COLOR_DEBUG
}
 
enum  {
  PCSC_LOG_DEBUG = 0 ,
  PCSC_LOG_INFO ,
  PCSC_LOG_ERROR ,
  PCSC_LOG_CRITICAL
}
 

Functions

const char * rv2text (unsigned int rv)
 
PCSC_API void log_msg_rv (const int priority, unsigned int rv, const char *fmt,...) __attribute__((format(printf
 
PCSC_API void PCSC_API void log_msg (const int priority, const char *fmt,...) __attribute__((format(printf
 
PCSC_API void PCSC_API void PCSC_API void log_xxd (const int priority, const char *msg, const unsigned char *buffer, const int size)
 
void DebugLogSuppress (const int)
 
void DebugLogSetLogType (const int)
 
void DebugLogSetCategory (const int)
 
void DebugLogCategory (const int, const unsigned char *, const int)
 
PCSC_API void DebugLogSetLevel (const int level)
 

Detailed Description

This handles debugging.

Note
log message is sent to syslog or stderr depending on –foreground command line argument
Log1(priority, "text");
log "text" with priority level priority
Log2(priority, "text: %d", 1234);
log "text: 1234"
the format string can be anything printf() can understand
Log3(priority, "text: %d %d", 1234, 5678);
log "text: 1234 5678"
the format string can be anything printf() can understand
LogXxd(priority, msg, buffer, size);
log "msg" + a hex dump of size bytes of buffer[]

Definition in file debuglog.h.

Macro Definition Documentation

◆ __attribute__

#define __attribute__ ( x)    /*nothing*/

Definition at line 85 of file debuglog.h.

◆ __FUNCTION__

#define __FUNCTION__   ""

Definition at line 81 of file debuglog.h.

◆ DEBUG_CATEGORY_APDU

#define DEBUG_CATEGORY_APDU   1

Definition at line 69 of file debuglog.h.

◆ DEBUG_CATEGORY_NOTHING

#define DEBUG_CATEGORY_NOTHING   0

Definition at line 68 of file debuglog.h.

◆ DEBUG_CATEGORY_SW

#define DEBUG_CATEGORY_SW   2

Definition at line 70 of file debuglog.h.

◆ DebugLogA

#define DebugLogA ( a)    Log1(PCSC_LOG_INFO, a)

Definition at line 118 of file debuglog.h.

◆ DebugLogB

#define DebugLogB ( a,
b )   Log2(PCSC_LOG_INFO, a, b)

Definition at line 119 of file debuglog.h.

◆ DebugLogC

#define DebugLogC ( a,
b,
c )   Log3(PCSC_LOG_INFO, a, b, c)

Definition at line 120 of file debuglog.h.

◆ Log0

#define Log0 ( priority)    log_msg(priority, "%s:%d:%s()", __FILE__, __LINE__, __FUNCTION__)

Definition at line 107 of file debuglog.h.

◆ Log1

#define Log1 ( priority,
fmt )   log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__)

Definition at line 108 of file debuglog.h.

◆ Log2

#define Log2 ( priority,
fmt,
data )   log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data)

Definition at line 109 of file debuglog.h.

◆ Log3

#define Log3 ( priority,
fmt,
data1,
data2 )   log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2)

Definition at line 110 of file debuglog.h.

◆ Log4

#define Log4 ( priority,
fmt,
data1,
data2,
data3 )   log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3)

Definition at line 111 of file debuglog.h.

◆ Log5

#define Log5 ( priority,
fmt,
data1,
data2,
data3,
data4 )   log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3, data4)

Definition at line 113 of file debuglog.h.

◆ Log9

#define Log9 ( priority,
fmt,
data1,
data2,
data3,
data4,
data5,
data6,
data7,
data8 )   log_msg(priority, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2, data3, data4, data5, data6, data7, data8)

Definition at line 114 of file debuglog.h.

◆ LogRv4

#define LogRv4 ( priority,
rv,
fmt,
data1,
data2 )   log_msg_rv(priority, rv, "%s:%d:%s() " fmt, __FILE__, __LINE__, __FUNCTION__, data1, data2)

Definition at line 112 of file debuglog.h.

◆ LogXxd

#define LogXxd ( priority,
msg,
buffer,
size )   log_xxd(priority, msg, buffer, size)

Definition at line 115 of file debuglog.h.

◆ PCSC_API

#define PCSC_API

Definition at line 58 of file debuglog.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Definition at line 61 of file debuglog.h.

◆ anonymous enum

anonymous enum

Definition at line 72 of file debuglog.h.

Function Documentation

◆ DebugLogCategory()

void DebugLogCategory ( const int category,
const unsigned char * buffer,
const int len )

Definition at line 416 of file debuglog.c.

◆ DebugLogSetCategory()

void DebugLogSetCategory ( const int dbginfo)

Definition at line 402 of file debuglog.c.

◆ DebugLogSetLevel()

PCSC_API void DebugLogSetLevel ( const int level)

Definition at line 377 of file debuglog.c.

◆ DebugLogSetLogType()

void DebugLogSetLogType ( const int dbgtype)

Definition at line 335 of file debuglog.c.

◆ log_xxd()

PCSC_API void PCSC_API void PCSC_API void log_xxd ( const int priority,
const char * msg,
const unsigned char * buffer,
const int size )

Definition at line 321 of file debuglog.c.

◆ rv2text()

const char * rv2text ( unsigned int rv)

Definition at line 154 of file debuglog.c.