From 060814daa83f6a94f5934464ae42a406c5c7e947 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 27 Sep 2013 22:31:24 +0200 Subject: Log: new logging library API Prepare to migrate away from GLib. Currently, we're still using GLib as a backend. --- src/decoder/SndfileDecoderPlugin.cxx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/decoder/SndfileDecoderPlugin.cxx') diff --git a/src/decoder/SndfileDecoderPlugin.cxx b/src/decoder/SndfileDecoderPlugin.cxx index 56853958c..5c7efe230 100644 --- a/src/decoder/SndfileDecoderPlugin.cxx +++ b/src/decoder/SndfileDecoderPlugin.cxx @@ -24,11 +24,12 @@ #include "CheckAudioFormat.hxx" #include "tag/TagHandler.hxx" #include "util/Error.hxx" +#include "util/Domain.hxx" +#include "Log.hxx" #include -#undef G_LOG_DOMAIN -#define G_LOG_DOMAIN "sndfile" +static constexpr Domain sndfile_domain("sndfile"); static sf_count_t sndfile_vio_get_filelen(void *user_data) @@ -57,7 +58,7 @@ sndfile_vio_read(void *ptr, sf_count_t count, void *user_data) Error error; size_t nbytes = is->LockRead(ptr, count, error); if (nbytes == 0 && error.IsDefined()) { - g_warning("%s", error.GetMessage()); + LogError(error); return -1; } @@ -124,7 +125,7 @@ sndfile_stream_decode(struct decoder *decoder, struct input_stream *is) sf = sf_open_virtual(&vio, SFM_READ, &info, is); if (sf == nullptr) { - g_warning("sf_open_virtual() failed"); + LogWarning(sndfile_domain, "sf_open_virtual() failed"); return; } @@ -136,7 +137,7 @@ sndfile_stream_decode(struct decoder *decoder, struct input_stream *is) if (!audio_format_init_checked(audio_format, info.samplerate, SampleFormat::S32, info.channels, error)) { - g_warning("%s", error.GetMessage()); + LogError(error); return; } @@ -187,7 +188,8 @@ sndfile_scan_file(const char *path_fs, if (!audio_valid_sample_rate(info.samplerate)) { sf_close(sf); - g_warning("Invalid sample rate in %s\n", path_fs); + FormatWarning(sndfile_domain, + "Invalid sample rate in %s", path_fs); return false; } -- cgit v1.2.3