summaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authorDaniel Elstner <daniel.kitta@gmail.com>2015-09-13 21:10:40 +0200
committerDaniel Elstner <daniel.kitta@gmail.com>2015-09-13 21:10:40 +0200
commit9fb7e7fe2c7edafdeedf1976d1723ffe557c8a7c (patch)
treedb28fb4973ff651a12c27f0a9fb9cf7ca2f05d8d /log.c
parent2730fe2397101f2c0a66abd3a7fd5fa531d3c710 (diff)
downloadlibsigrokdecode-9fb7e7fe2c7edafdeedf1976d1723ffe557c8a7c.tar.gz
libsigrokdecode-9fb7e7fe2c7edafdeedf1976d1723ffe557c8a7c.zip
log: Remove srd_log_logdomain_{get,set} from the API
The confusingly named srd_log_logdomain_set() simply set a global string prefixed to the log message by the default log callback. This is pretty much useless, misleadingly named, and not used by either sigrok-cli or PulseView.
Diffstat (limited to 'log.c')
-rw-r--r--log.c54
1 files changed, 1 insertions, 53 deletions
diff --git a/log.c b/log.c
index 9d0bc73..d9030c2 100644
--- a/log.c
+++ b/log.c
@@ -53,13 +53,6 @@ static srd_log_callback srd_log_cb = srd_logv;
*/
static void *srd_log_cb_data = NULL;
-/* Log domain (a short string that is used as prefix for all messages). */
-/** @cond PRIVATE */
-#define LOGDOMAIN_MAXLEN 30
-#define LOGDOMAIN_DEFAULT "srd: "
-/** @endcond */
-static char srd_log_domain[LOGDOMAIN_MAXLEN + 1] = LOGDOMAIN_DEFAULT;
-
/**
* Set the libsigrokdecode loglevel.
*
@@ -105,50 +98,6 @@ SRD_API int srd_log_loglevel_get(void)
}
/**
- * Set the libsigrokdecode logdomain string.
- *
- * @param logdomain The string to use as logdomain for libsigrokdecode log
- * messages from now on. Must not be NULL. The maximum
- * length of the string is 30 characters (this does not
- * include the trailing NUL-byte). Longer strings are
- * silently truncated.
- * In order to not use a logdomain, pass an empty string.
- * The function makes its own copy of the input string, i.e.
- * the caller does not need to keep it around.
- *
- * @return SRD_OK upon success, SRD_ERR_ARG upon invalid logdomain.
- *
- * @since 0.1.0
- */
-SRD_API int srd_log_logdomain_set(const char *logdomain)
-{
- if (!logdomain) {
- srd_err("log: %s: logdomain was NULL", __func__);
- return SRD_ERR_ARG;
- }
-
- snprintf((char *)&srd_log_domain, LOGDOMAIN_MAXLEN, "%s", logdomain);
-
- srd_dbg("Log domain set to '%s'.", (const char *)&srd_log_domain);
-
- return SRD_OK;
-}
-
-/**
- * Get the currently configured libsigrokdecode logdomain.
- *
- * @return A copy of the currently configured libsigrokdecode logdomain
- * string. The caller is responsible for g_free()ing the string when
- * it is no longer needed.
- *
- * @since 0.1.0
- */
-SRD_API char *srd_log_logdomain_get(void)
-{
- return g_strdup((const char *)&srd_log_domain);
-}
-
-/**
* Set the libsigrokdecode log callback to the specified function.
*
* @param cb Function pointer to the log callback function to use.
@@ -212,8 +161,7 @@ static int srd_logv(void *cb_data, int loglevel, const char *format,
if (loglevel > cur_loglevel)
return SRD_OK;
- if (srd_log_domain[0] != '\0')
- fprintf(stderr, "%s", srd_log_domain);
+ fputs("srd: ", stderr);
ret = vfprintf(stderr, format, args);
fprintf(stderr, "\n");