aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command.c7
-rw-r--r--src/decoder_thread.c3
-rw-r--r--src/log.c24
-rw-r--r--src/log.h3
-rw-r--r--src/main.c6
-rw-r--r--src/permission.c11
-rw-r--r--src/sig_handlers.c2
-rw-r--r--src/song_save.c10
-rw-r--r--src/tag.c5
9 files changed, 22 insertions, 49 deletions
diff --git a/src/command.c b/src/command.c
index 513a53e5b..7603f669c 100644
--- a/src/command.c
+++ b/src/command.c
@@ -33,7 +33,6 @@
#include "stats.h"
#include "permission.h"
#include "buffer2array.h"
-#include "log.h"
#include "stored_playlist.h"
#include "ack.h"
#include "output_command.h"
@@ -1797,10 +1796,10 @@ command_process_list(struct client *client,
for (GSList *cur = list; cur != NULL; cur = g_slist_next(cur)) {
char *cmd = cur->data;
- DEBUG("command_process_list: process command \"%s\"\n",
- cmd);
+ g_debug("command_process_list: process command \"%s\"",
+ cmd);
ret = command_process(client, cmd);
- DEBUG("command_process_list: command returned %i\n", ret);
+ g_debug("command_process_list: command returned %i", ret);
if (ret != COMMAND_RETURN_OK || client_is_expired(client))
break;
else if (list_ok)
diff --git a/src/decoder_thread.c b/src/decoder_thread.c
index c04d0b849..dee16218a 100644
--- a/src/decoder_thread.c
+++ b/src/decoder_thread.c
@@ -29,7 +29,6 @@
#include "tag.h"
#include "mapper.h"
#include "path.h"
-#include "log.h"
#include "uri.h"
#include <glib.h>
@@ -269,5 +268,5 @@ void decoder_thread_start(void)
dc.thread = g_thread_create(decoder_task, NULL, true, &e);
if (dc.thread == NULL)
- FATAL("Failed to spawn decoder task: %s\n", e->message);
+ g_error("Failed to spawn decoder task: %s", e->message);
}
diff --git a/src/log.c b/src/log.c
index 4992bd41a..b9bf6b6f6 100644
--- a/src/log.c
+++ b/src/log.c
@@ -285,30 +285,6 @@ void setup_log_output(bool use_stdout)
}
}
-#define log_func(func,level) \
-G_GNUC_PRINTF(1, 2) void func(const char *fmt, ...) \
-{ \
- if (level <= log_threshold) { \
- va_list args; \
- va_start(args, fmt); \
- g_logv(NULL, level, fmt, args); \
- va_end(args); \
- } \
-}
-
-log_func(DEBUG, G_LOG_LEVEL_DEBUG)
-
-#undef log_func
-
-G_GNUC_PRINTF(1, 2) G_GNUC_NORETURN void FATAL(const char *fmt, ...)
-{
- va_list args;
- va_start(args, fmt);
- g_logv(NULL, G_LOG_LEVEL_ERROR, fmt, args);
- va_end(args);
- exit(EXIT_FAILURE);
-}
-
int cycle_log_files(void)
{
int fd;
diff --git a/src/log.h b/src/log.h
index 19b3d57f2..3654fa7a7 100644
--- a/src/log.h
+++ b/src/log.h
@@ -23,9 +23,6 @@
#include <glib.h>
#include <stdbool.h>
-G_GNUC_PRINTF(1, 2) void DEBUG(const char *fmt, ...);
-G_GNUC_PRINTF(1, 2) G_GNUC_NORETURN void FATAL(const char *fmt, ...);
-
/**
* Configure a logging destination for daemon startup, before the
* configuration file is read. This allows the daemon to use the
diff --git a/src/main.c b/src/main.c
index 483947a1a..a8e6ddae5 100644
--- a/src/main.c
+++ b/src/main.c
@@ -168,9 +168,9 @@ initialize_decoder_and_player(void)
if (param != NULL) {
perc = strtod(param->value, &test);
if (*test != '%' || perc < 0 || perc > 100) {
- FATAL("buffered before play \"%s\" is not a positive "
- "percentage and less than 100 percent, line %i"
- "\n", param->value, param->line);
+ g_error("buffered before play \"%s\" is not a positive "
+ "percentage and less than 100 percent, line %i",
+ param->value, param->line);
}
} else
perc = DEFAULT_BUFFER_BEFORE_PLAY;
diff --git a/src/permission.c b/src/permission.c
index da51d4b80..7df4e27fc 100644
--- a/src/permission.c
+++ b/src/permission.c
@@ -19,7 +19,6 @@
#include "permission.h"
#include "conf.h"
-#include "log.h"
#include <glib.h>
@@ -59,7 +58,7 @@ static unsigned parsePermissions(const char *string)
} else if (strcmp(temp, PERMISSION_ADMIN_STRING) == 0) {
permission |= PERMISSION_ADMIN;
} else {
- FATAL("unknown permission \"%s\"\n", temp);
+ g_error("unknown permission \"%s\"", temp);
}
}
@@ -90,10 +89,10 @@ void initPermissions(void)
strchr(param->value, PERMISSION_PASSWORD_CHAR);
if (separator == NULL)
- FATAL("\"%c\" not found in password string "
- "\"%s\", line %i\n",
- PERMISSION_PASSWORD_CHAR,
- param->value, param->line);
+ g_error("\"%c\" not found in password string "
+ "\"%s\", line %i",
+ PERMISSION_PASSWORD_CHAR,
+ param->value, param->line);
password = g_strndup(param->value,
separator - param->value);
diff --git a/src/sig_handlers.c b/src/sig_handlers.c
index c42f0b169..e70e1a159 100644
--- a/src/sig_handlers.c
+++ b/src/sig_handlers.c
@@ -51,7 +51,7 @@ x_sigaction(int signum, const struct sigaction *act)
static void
handle_reload_event(void)
{
- DEBUG("got SIGHUP, rereading DB\n");
+ g_debug("got SIGHUP, reopening log files");
cycle_log_files();
}
diff --git a/src/song_save.c b/src/song_save.c
index e0d61a3be..1d2724e83 100644
--- a/src/song_save.c
+++ b/src/song_save.c
@@ -23,10 +23,14 @@
#include "directory.h"
#include "path.h"
#include "tag.h"
-#include "log.h"
+
+#include <glib.h>
#include <stdlib.h>
+#undef G_LOG_DOMAIN
+#define G_LOG_DOMAIN "song"
+
#define SONG_KEY "key: "
#define SONG_MTIME "mtime: "
@@ -126,7 +130,7 @@ void readSongInfoIntoList(FILE *fp, struct songvec *sv,
} else if (*buffer == 0) {
/* ignore empty lines (starting with '\0') */
} else if (song == NULL) {
- FATAL("Problems reading song info\n");
+ g_error("Problems reading song info");
} else if (0 == strncmp(SONG_FILE, buffer, strlen(SONG_FILE))) {
/* we don't need this info anymore */
} else if ((value = matchesAnMpdTagItemKey(buffer,
@@ -148,7 +152,7 @@ void readSongInfoIntoList(FILE *fp, struct songvec *sv,
song->mtime = atoi(&(buffer[strlen(SONG_MTIME)]));
}
else
- FATAL("songinfo: unknown line in db: %s\n", buffer);
+ g_error("unknown line in db: %s", buffer);
}
if (song)
diff --git a/src/tag.c b/src/tag.c
index c80bcff10..69c4c19bd 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -20,7 +20,6 @@
#include "tag.h"
#include "tag_internal.h"
#include "tag_pool.h"
-#include "log.h"
#include "conf.h"
#include "song.h"
@@ -106,8 +105,8 @@ void tag_lib_init(void)
}
}
if (strlen(c) && i == TAG_NUM_OF_ITEM_TYPES) {
- FATAL("error parsing metadata item \"%s\"\n",
- c);
+ g_error("error parsing metadata item \"%s\"",
+ c);
}
s++;
c = s;