Log: new logging library API
Prepare to migrate away from GLib. Currently, we're still using GLib as a backend.
This commit is contained in:
@@ -25,9 +25,13 @@
|
||||
#include "ArchiveFile.hxx"
|
||||
#include "InputPlugin.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
static constexpr Domain archive_domain("archive");
|
||||
|
||||
/**
|
||||
* select correct archive plugin to handle the input stream
|
||||
* may allow stacking of archive plugins. for example for handling
|
||||
@@ -51,7 +55,8 @@ input_archive_open(const char *pathname,
|
||||
pname = g_strdup(pathname);
|
||||
// archive_lookup will modify pname when true is returned
|
||||
if (!archive_lookup(pname, &archive, &filename, &suffix)) {
|
||||
g_debug("not an archive, lookup %s failed\n", pname);
|
||||
FormatDebug(archive_domain,
|
||||
"not an archive, lookup %s failed", pname);
|
||||
g_free(pname);
|
||||
return NULL;
|
||||
}
|
||||
@@ -59,7 +64,8 @@ input_archive_open(const char *pathname,
|
||||
//check which archive plugin to use (by ext)
|
||||
arplug = archive_plugin_from_suffix(suffix);
|
||||
if (!arplug) {
|
||||
g_warning("can't handle archive %s\n",archive);
|
||||
FormatWarning(archive_domain,
|
||||
"can't handle archive %s", archive);
|
||||
g_free(pname);
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include "InputPlugin.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
@@ -195,17 +196,20 @@ input_cdio_open(const char *uri,
|
||||
bool reverse_endian;
|
||||
switch (data_bigendianp(i->drv)) {
|
||||
case -1:
|
||||
g_debug("cdda: drive returns unknown audio data");
|
||||
LogDebug(cdio_domain, "drive returns unknown audio data");
|
||||
reverse_endian = false;
|
||||
break;
|
||||
|
||||
case 0:
|
||||
g_debug("cdda: drive returns audio data Little Endian.");
|
||||
LogDebug(cdio_domain, "drive returns audio data Little Endian");
|
||||
reverse_endian = G_BYTE_ORDER == G_BIG_ENDIAN;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
g_debug("cdda: drive returns audio data Big Endian.");
|
||||
LogDebug(cdio_domain, "drive returns audio data Big Endian");
|
||||
reverse_endian = G_BYTE_ORDER == G_LITTLE_ENDIAN;
|
||||
break;
|
||||
|
||||
default:
|
||||
error.Format(cdio_domain, "Drive returns unknown data type %d",
|
||||
data_bigendianp(i->drv));
|
||||
@@ -305,7 +309,8 @@ input_cdio_read(struct input_stream *is, void *ptr, size_t length,
|
||||
|
||||
s_err = cdda_errors(cis->drv);
|
||||
if (s_err) {
|
||||
g_warning("paranoia_read: %s", s_err );
|
||||
FormatError(cdio_domain,
|
||||
"paranoia_read: %s", s_err);
|
||||
free(s_err);
|
||||
}
|
||||
s_mess = cdda_messages(cis->drv);
|
||||
|
@@ -31,6 +31,7 @@
|
||||
#include "IOThread.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
@@ -53,9 +54,6 @@
|
||||
#error libcurl is too old
|
||||
#endif
|
||||
|
||||
#undef G_LOG_DOMAIN
|
||||
#define G_LOG_DOMAIN "input_curl"
|
||||
|
||||
/**
|
||||
* Do not buffer more than this number of bytes. It should be a
|
||||
* reasonable limit that doesn't make low-end machines suffer too
|
||||
@@ -297,8 +295,9 @@ CurlSockets::UpdateSockets()
|
||||
CURLMcode mcode = curl_multi_fdset(curl.multi, &rfds, &wfds,
|
||||
&efds, &max_fd);
|
||||
if (mcode != CURLM_OK) {
|
||||
g_warning("curl_multi_fdset() failed: %s\n",
|
||||
curl_multi_strerror(mcode));
|
||||
FormatError(curlm_domain,
|
||||
"curl_multi_fdset() failed: %s",
|
||||
curl_multi_strerror(mcode));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -537,8 +536,9 @@ CurlSockets::PrepareSockets()
|
||||
|
||||
return timeout2;
|
||||
} else {
|
||||
g_warning("curl_multi_timeout() failed: %s\n",
|
||||
curl_multi_strerror(mcode));
|
||||
FormatWarning(curlm_domain,
|
||||
"curl_multi_timeout() failed: %s",
|
||||
curl_multi_strerror(mcode));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -880,7 +880,7 @@ input_curl_headerfunction(void *ptr, size_t size, size_t nmemb, void *stream)
|
||||
buffer[end - value] = 0;
|
||||
|
||||
icy_metaint = g_ascii_strtoull(buffer, NULL, 10);
|
||||
g_debug("icy-metaint=%zu", icy_metaint);
|
||||
FormatDebug(curl_domain, "icy-metaint=%zu", icy_metaint);
|
||||
|
||||
if (icy_metaint > 0) {
|
||||
c->icy.Start(icy_metaint);
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include "InputStream.hxx"
|
||||
#include "InputPlugin.hxx"
|
||||
#include "tag/Tag.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
extern "C" {
|
||||
#include <despotify.h>
|
||||
@@ -85,7 +86,7 @@ refill_buffer(DespotifyInputStream *ctx)
|
||||
break;
|
||||
|
||||
if (rc < 0) {
|
||||
g_debug("despotify_get_pcm error\n");
|
||||
LogDebug(despotify_domain, "despotify_get_pcm error");
|
||||
ctx->eof = true;
|
||||
break;
|
||||
}
|
||||
@@ -108,14 +109,14 @@ static void callback(gcc_unused struct despotify_session* ds,
|
||||
break;
|
||||
|
||||
case DESPOTIFY_TRACK_PLAY_ERROR:
|
||||
g_debug("Track play error\n");
|
||||
LogWarning(despotify_domain, "Track play error");
|
||||
ctx->eof = true;
|
||||
ctx->len_available = 0;
|
||||
break;
|
||||
|
||||
case DESPOTIFY_END_OF_PLAYLIST:
|
||||
ctx->eof = true;
|
||||
g_debug("End of playlist: %d\n", ctx->eof);
|
||||
FormatDebug(despotify_domain, "End of playlist: %d", ctx->eof);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -139,7 +140,7 @@ input_despotify_open(const char *url,
|
||||
|
||||
ds_link = despotify_link_from_uri(url + 6);
|
||||
if (!ds_link) {
|
||||
g_debug("Can't find %s\n", url);
|
||||
FormatDebug(despotify_domain, "Can't find %s", url);
|
||||
return NULL;
|
||||
}
|
||||
if (ds_link->type != LINK_TYPE_TRACK) {
|
||||
|
@@ -34,9 +34,6 @@ extern "C" {
|
||||
#include <libavformat/avformat.h>
|
||||
}
|
||||
|
||||
#undef G_LOG_DOMAIN
|
||||
#define G_LOG_DOMAIN "input_ffmpeg"
|
||||
|
||||
struct FfmpegInputStream {
|
||||
struct input_stream base;
|
||||
|
||||
|
@@ -33,9 +33,6 @@
|
||||
#include <string.h>
|
||||
#include <glib.h>
|
||||
|
||||
#undef G_LOG_DOMAIN
|
||||
#define G_LOG_DOMAIN "input_file"
|
||||
|
||||
static constexpr Domain file_domain("file");
|
||||
|
||||
struct FileInputStream {
|
||||
|
@@ -31,9 +31,6 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#undef G_LOG_DOMAIN
|
||||
#define G_LOG_DOMAIN "input_mms"
|
||||
|
||||
struct MmsInputStream {
|
||||
struct input_stream base;
|
||||
|
||||
|
@@ -28,9 +28,6 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#undef G_LOG_DOMAIN
|
||||
#define G_LOG_DOMAIN "input_rewind"
|
||||
|
||||
extern const struct input_plugin rewind_input_plugin;
|
||||
|
||||
struct RewindInputStream {
|
||||
|
Reference in New Issue
Block a user