Hi,
I propose to introduce the following short form to insert debug messages of the
'normal' level.
Any objections?
Kind wishes,
Viktor.
Index: src/libopensc/log.c
===================================================================
--- src/libopensc/log.c (révision 5031)
+++ src/libopensc/log.c (copie de travail)
@@ -128,7 +128,15 @@
va_end(ap);
}
+void _sc_logn(struct sc_context *ctx, const char *format, ...)
+{
+ va_list ap;
+ va_start(ap, format);
+ sc_do_log_va(ctx, SC_LOG_DEBUG_NORMAL, NULL, 0, NULL, format, ap);
+ va_end(ap);
+}
+
/* Although not used, we need this for consistent exports */
void sc_hex_dump(struct sc_context *ctx, int level, const u8 * in, size_t count, char *buf, size_t len)
{
Index: src/libopensc/log.h
===================================================================
--- src/libopensc/log.h (révision 5031)
+++ src/libopensc/log.h (copie de travail)
@@ -46,8 +46,10 @@
#if defined(__GNUC__)
#define sc_debug(ctx, level, format, args...) sc_do_log(ctx, level, __FILE__, __LINE__, __FUNCTION__, format , ## args)
+#define sc_logn(ctx, format, args...) sc_do_log(ctx, SC_LOG_DEBUG_NORMAL, __FILE__, __LINE__, __FUNCTION__, format , ## args)
#else
#define sc_debug _sc_debug
+#define sc_logn _sc_logn
#endif
void sc_do_log(struct sc_context *ctx, int level, const char *file, int line, const char *func,
@@ -55,6 +57,7 @@
void sc_do_log_va(struct sc_context *ctx, int level, const char *file, int line, const char *func,
const char *format, va_list args);
void _sc_debug(struct sc_context *ctx, int level, const char *format, ...);
+void _sc_logn(struct sc_context *ctx, const char *format, ...);
void sc_hex_dump(struct sc_context *ctx, int level, const u8 * buf, size_t len, char *out, size_t outlen);
char * sc_dump_hex(const u8 * in, size_t count);
@@ -62,6 +65,7 @@
#define SC_FUNC_CALLED(ctx, level) do { \
sc_do_log(ctx, level, __FILE__, __LINE__, __FUNCTION__, "called\n"); \
} while (0)
+#define LOGN_FUNC_CALLED(ctx) SC_FUNC_CALLED((ctx), SC_LOG_DEBUG_NORMAL)
#define SC_FUNC_RETURN(ctx, level, r) do { \
int _ret = r; \
@@ -74,6 +78,7 @@
} \
return _ret; \
} while(0)
+#define LOGN_FUNC_RETURN(ctx, r) SC_FUNC_RETURN((ctx), SC_LOG_DEBUG_NORMAL, (r))
#define SC_TEST_RET(ctx, level, r, text) do { \
int _ret = (r); \
@@ -83,6 +88,7 @@
return _ret; \
} \
} while(0)
+#define LOGN_TEST_RET(ctx, r, text) SC_TEST_RET((ctx), SC_LOG_DEBUG_NORMAL, (r), (text))
#ifdef __cplusplus
}
_______________________________________________
opensc-devel mailing list
[email protected]
http://www.opensc-project.org/mailman/listinfo/opensc-devel