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:
@@ -32,6 +32,7 @@
|
||||
#include "PlaylistPlugin.hxx"
|
||||
#include "fs/Path.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
@@ -174,7 +175,7 @@ int main(int argc, char **argv)
|
||||
io_thread_start();
|
||||
|
||||
if (!input_stream_global_init(error)) {
|
||||
g_warning("%s", error.GetMessage());
|
||||
LogError(error);
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -193,7 +194,7 @@ int main(int argc, char **argv)
|
||||
is = input_stream::Open(uri, mutex, cond, error);
|
||||
if (is == NULL) {
|
||||
if (error.IsDefined())
|
||||
g_warning("%s", error.GetMessage());
|
||||
LogError(error);
|
||||
else
|
||||
g_printerr("input_stream::Open() failed\n");
|
||||
return 2;
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include "stdbin.h"
|
||||
#include "TextInputStream.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#ifdef ENABLE_ARCHIVE
|
||||
#include "ArchiveList.hxx"
|
||||
@@ -66,7 +67,7 @@ dump_input_stream(struct input_stream *is)
|
||||
is->WaitReady();
|
||||
|
||||
if (!is->Check(error)) {
|
||||
g_warning("%s", error.GetMessage());
|
||||
LogError(error);
|
||||
is->Unlock();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -82,7 +83,7 @@ dump_input_stream(struct input_stream *is)
|
||||
is->Lock();
|
||||
|
||||
if (!is->Check(error)) {
|
||||
g_warning("%s", error.GetMessage());
|
||||
LogError(error);
|
||||
is->Unlock();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -123,7 +124,7 @@ int main(int argc, char **argv)
|
||||
|
||||
Error error;
|
||||
if (!input_stream_global_init(error)) {
|
||||
g_warning("%s", error.GetMessage());
|
||||
LogError(error);
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -138,7 +139,7 @@ int main(int argc, char **argv)
|
||||
is->Close();
|
||||
} else {
|
||||
if (error.IsDefined())
|
||||
g_warning("%s", error.GetMessage());
|
||||
LogError(error);
|
||||
else
|
||||
g_printerr("input_stream::Open() failed\n");
|
||||
ret = 2;
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include "tag/TagId3.hxx"
|
||||
#include "tag/ApeTag.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
@@ -167,7 +168,7 @@ int main(int argc, char **argv)
|
||||
|
||||
Error error;
|
||||
if (!input_stream_global_init(error)) {
|
||||
g_warning("%s", error.GetMessage());
|
||||
LogError(error);
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include "InputStream.hxx"
|
||||
#include "AudioFormat.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "Log.hxx"
|
||||
#include "stdbin.h"
|
||||
|
||||
#include <glib.h>
|
||||
@@ -167,7 +168,7 @@ int main(int argc, char **argv)
|
||||
|
||||
Error error;
|
||||
if (!input_stream_global_init(error)) {
|
||||
g_warning("%s", error.GetMessage());
|
||||
LogError(error);
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -192,7 +193,7 @@ int main(int argc, char **argv)
|
||||
input_stream::Open(decoder.uri, mutex, cond, error);
|
||||
if (is == NULL) {
|
||||
if (error.IsDefined())
|
||||
g_warning("%s", error.GetMessage());
|
||||
LogError(error);
|
||||
else
|
||||
g_printerr("input_stream::Open() failed\n");
|
||||
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#include "InotifySource.hxx"
|
||||
#include "event/Loop.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
@@ -68,14 +69,14 @@ int main(int argc, char **argv)
|
||||
my_inotify_callback,
|
||||
nullptr, error);
|
||||
if (source == NULL) {
|
||||
g_warning("%s", error.GetMessage());
|
||||
LogError(error);
|
||||
return 2;
|
||||
}
|
||||
|
||||
int descriptor = source->Add(path, IN_MASK, error);
|
||||
if (descriptor < 0) {
|
||||
delete source;
|
||||
g_warning("%s", error.GetMessage());
|
||||
LogError(error);
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
@@ -26,6 +26,7 @@
|
||||
#include "InputInit.hxx"
|
||||
#include "IOThread.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#ifdef ENABLE_ARCHIVE
|
||||
#include "ArchiveList.hxx"
|
||||
@@ -61,7 +62,7 @@ dump_input_stream(struct input_stream *is)
|
||||
is->WaitReady();
|
||||
|
||||
if (!is->Check(error)) {
|
||||
g_warning("%s", error.GetMessage());
|
||||
LogError(error);
|
||||
is->Unlock();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -84,7 +85,7 @@ dump_input_stream(struct input_stream *is)
|
||||
num_read = is->Read(buffer, sizeof(buffer), error);
|
||||
if (num_read == 0) {
|
||||
if (error.IsDefined())
|
||||
g_warning("%s", error.GetMessage());
|
||||
LogError(error);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -95,7 +96,7 @@ dump_input_stream(struct input_stream *is)
|
||||
}
|
||||
|
||||
if (!is->Check(error)) {
|
||||
g_warning("%s", error.GetMessage());
|
||||
LogError(error);
|
||||
is->Unlock();
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
@@ -136,7 +137,7 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
if (!input_stream_global_init(error)) {
|
||||
g_warning("%s", error.GetMessage());
|
||||
LogError(error);
|
||||
return 2;
|
||||
}
|
||||
|
||||
@@ -151,7 +152,7 @@ int main(int argc, char **argv)
|
||||
is->Close();
|
||||
} else {
|
||||
if (error.IsDefined())
|
||||
g_warning("%s", error.GetMessage());
|
||||
LogError(error);
|
||||
else
|
||||
g_printerr("input_stream::Open() failed\n");
|
||||
ret = 2;
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include "config.h"
|
||||
#include "system/Resolver.hxx"
|
||||
#include "util/Error.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
@@ -45,7 +46,7 @@ int main(int argc, char **argv)
|
||||
resolve_host_port(argv[1], 80, AI_PASSIVE, SOCK_STREAM,
|
||||
error);
|
||||
if (ai == NULL) {
|
||||
g_warning("%s", error.GetMessage());
|
||||
LogError(error);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -54,7 +55,7 @@ int main(int argc, char **argv)
|
||||
error);
|
||||
if (p == NULL) {
|
||||
freeaddrinfo(ai);
|
||||
g_warning("%s", error.GetMessage());
|
||||
LogError(error);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user