/*
- * This file is part of the sigrok project.
+ * This file is part of the libsigrok project.
*
* Copyright (C) 2011-2012 Uwe Hermann <uwe@hermann-uwe.de>
*
#include <stdarg.h>
#include <stdio.h>
-#include "sigrok.h"
-#include "sigrok-internal.h"
+#include "libsigrok.h"
+#include "libsigrok-internal.h"
+
+/**
+ * @file
+ *
+ * Controlling the libsigrok message logging functionality.
+ */
+
+/**
+ * @defgroup grp_logging Logging
+ *
+ * Controlling the libsigrok message logging functionality.
+ *
+ * @{
+ */
/* Currently selected libsigrok loglevel. Default: SR_LOG_WARN. */
static int sr_loglevel = SR_LOG_WARN; /* Show errors+warnings per default. */
static void *sr_log_callback_data = NULL;
/* Log domain (a short string that is used as prefix for all messages). */
+/** @cond PRIVATE */
#define LOGDOMAIN_MAXLEN 30
#define LOGDOMAIN_DEFAULT "sr: "
+/** @endcond */
static char sr_log_domain[LOGDOMAIN_MAXLEN + 1] = LOGDOMAIN_DEFAULT;
/**
* SR_LOG_INFO, SR_LOG_DBG, or SR_LOG_SPEW).
*
* @return SR_OK upon success, SR_ERR_ARG upon invalid loglevel.
+ *
+ * @since 0.1.0
*/
SR_API int sr_log_loglevel_set(int loglevel)
{
* Get the libsigrok loglevel.
*
* @return The currently configured libsigrok loglevel.
+ *
+ * @since 0.1.0
*/
SR_API int sr_log_loglevel_get(void)
{
* the caller does not need to keep it around.
*
* @return SR_OK upon success, SR_ERR_ARG upon invalid logdomain.
+ *
+ * @since 0.1.0
*/
SR_API int sr_log_logdomain_set(const char *logdomain)
{
* @return A copy of the currently configured libsigrok logdomain
* string. The caller is responsible for g_free()ing the string when
* it is no longer needed.
+ *
+ * @since 0.1.0
*/
SR_API char *sr_log_logdomain_get(void)
{
* to be NULL if the caller doesn't need/want to pass any data.
*
* @return SR_OK upon success, SR_ERR_ARG upon invalid arguments.
+ *
+ * @since 0.1.0
*/
SR_API int sr_log_callback_set(sr_log_callback_t cb, void *cb_data)
{
* Additionally, the internal 'sr_log_callback_data' pointer is set to NULL.
*
* @return SR_OK upon success, a negative error code otherwise.
+ *
+ * @since 0.1.0
*/
SR_API int sr_log_callback_set_default(void)
{
return ret;
}
+/** @private */
SR_PRIV int sr_log(int loglevel, const char *format, ...)
{
int ret;
return ret;
}
+/** @private */
SR_PRIV int sr_spew(const char *format, ...)
{
int ret;
return ret;
}
+/** @private */
SR_PRIV int sr_dbg(const char *format, ...)
{
int ret;
return ret;
}
+/** @private */
SR_PRIV int sr_info(const char *format, ...)
{
int ret;
return ret;
}
+/** @private */
SR_PRIV int sr_warn(const char *format, ...)
{
int ret;
return ret;
}
+/** @private */
SR_PRIV int sr_err(const char *format, ...)
{
int ret;
return ret;
}
+
+/** @} */