aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-11-04 22:20:11 +0100
committerMax Kellermann <max@duempel.org>2013-11-04 22:27:49 +0100
commitecf12a60e8f82df59b1cf1fcbab1609fb2dfd7f4 (patch)
tree2ac4cbbf24625362f49c39e7aac3f5b3a4470e32 /src
parent6de85cb047b3859f0e1b6d6db86cb735882278c8 (diff)
downloadmpd-ecf12a60e8f82df59b1cf1fcbab1609fb2dfd7f4.tar.gz
mpd-ecf12a60e8f82df59b1cf1fcbab1609fb2dfd7f4.tar.xz
mpd-ecf12a60e8f82df59b1cf1fcbab1609fb2dfd7f4.zip
Log: add level "DEFAULT"
Map LogLevel::INFO to G_LOG_LEVEL_INFO, and LogLevel::DEFAULT to G_LOG_LEVEL_MESSAGE. Now client connect/disconnect message are only logged on log_level "secure".
Diffstat (limited to '')
-rw-r--r--src/Log.cxx12
-rw-r--r--src/Log.hxx15
-rw-r--r--src/Main.cxx16
-rw-r--r--src/OutputInit.cxx14
-rw-r--r--src/PlayerThread.cxx2
-rw-r--r--src/UpdateArchive.cxx4
-rw-r--r--src/UpdateContainer.cxx4
-rw-r--r--src/UpdateRemove.cxx2
-rw-r--r--src/UpdateSong.cxx8
-rw-r--r--src/ZeroconfAvahi.cxx16
-rw-r--r--src/ZeroconfGlue.cxx4
-rw-r--r--src/decoder/FaadDecoderPlugin.cxx14
-rw-r--r--src/decoder/FfmpegDecoderPlugin.cxx4
-rw-r--r--src/output/JackOutputPlugin.cxx2
14 files changed, 72 insertions, 45 deletions
diff --git a/src/Log.cxx b/src/Log.cxx
index f36e68133..a46c0ced8 100644
--- a/src/Log.cxx
+++ b/src/Log.cxx
@@ -51,6 +51,9 @@ ToGLib(LogLevel level)
return G_LOG_LEVEL_DEBUG;
case LogLevel::INFO:
+ return G_LOG_LEVEL_INFO;
+
+ case LogLevel::DEFAULT:
return G_LOG_LEVEL_MESSAGE;
case LogLevel::WARNING:
@@ -102,6 +105,15 @@ FormatInfo(const Domain &domain, const char *fmt, ...)
}
void
+FormatDefault(const Domain &domain, const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ LogFormatV(domain, LogLevel::DEFAULT, fmt, ap);
+ va_end(ap);
+}
+
+void
FormatWarning(const Domain &domain, const char *fmt, ...)
{
va_list ap;
diff --git a/src/Log.hxx b/src/Log.hxx
index 38bc4a829..920a8d8a3 100644
--- a/src/Log.hxx
+++ b/src/Log.hxx
@@ -45,6 +45,11 @@ enum class LogLevel {
INFO,
/**
+ * Interesting informational message.
+ */
+ DEFAULT,
+
+ /**
* Warning: something may be wrong.
*/
WARNING,
@@ -84,6 +89,16 @@ void
FormatInfo(const Domain &domain, const char *fmt, ...);
static inline void
+LogDefault(const Domain &domain, const char *msg)
+{
+ Log(domain, LogLevel::DEFAULT, msg);
+}
+
+gcc_printf(2,3)
+void
+FormatDefault(const Domain &domain, const char *fmt, ...);
+
+static inline void
LogWarning(const Domain &domain, const char *msg)
{
Log(domain, LogLevel::WARNING, msg);
diff --git a/src/Main.cxx b/src/Main.cxx
index 5d47c0a1c..b45e2c3ae 100644
--- a/src/Main.cxx
+++ b/src/Main.cxx
@@ -160,18 +160,18 @@ glue_db_init_and_load(void)
const struct config_param *path = config_get_param(CONF_DB_FILE);
if (param != nullptr && path != nullptr)
- LogInfo(main_domain,
- "Found both 'database' and 'db_file' setting - ignoring the latter");
+ LogWarning(main_domain,
+ "Found both 'database' and 'db_file' setting - ignoring the latter");
if (!mapper_has_music_directory()) {
if (param != nullptr)
- LogInfo(main_domain,
- "Found database setting without "
- "music_directory - disabling database");
+ LogDefault(main_domain,
+ "Found database setting without "
+ "music_directory - disabling database");
if (path != nullptr)
- LogInfo(main_domain,
- "Found db_file setting without "
- "music_directory - disabling database");
+ LogDefault(main_domain,
+ "Found db_file setting without "
+ "music_directory - disabling database");
return true;
}
diff --git a/src/OutputInit.cxx b/src/OutputInit.cxx
index 91f7b306f..49b5d68b9 100644
--- a/src/OutputInit.cxx
+++ b/src/OutputInit.cxx
@@ -50,15 +50,15 @@
static const struct audio_output_plugin *
audio_output_detect(Error &error)
{
- LogInfo(output_domain, "Attempt to detect audio output device");
+ LogDefault(output_domain, "Attempt to detect audio output device");
audio_output_plugins_for_each(plugin) {
if (plugin->test_default_device == nullptr)
continue;
- FormatInfo(output_domain,
- "Attempting to detect a %s audio device",
- plugin->name);
+ FormatDefault(output_domain,
+ "Attempting to detect a %s audio device",
+ plugin->name);
if (ao_plugin_test_default_device(plugin))
return plugin;
}
@@ -310,9 +310,9 @@ audio_output_new(const config_param &param,
if (plugin == nullptr)
return nullptr;
- FormatInfo(output_domain,
- "Successfully detected a %s audio device",
- plugin->name);
+ FormatDefault(output_domain,
+ "Successfully detected a %s audio device",
+ plugin->name);
}
struct audio_output *ao = ao_plugin_init(plugin, param, error);
diff --git a/src/PlayerThread.cxx b/src/PlayerThread.cxx
index 7105e48d3..73a5a0527 100644
--- a/src/PlayerThread.cxx
+++ b/src/PlayerThread.cxx
@@ -875,7 +875,7 @@ Player::SongBorder()
{
const auto uri = song->GetURI();
- FormatInfo(player_domain, "played \"%s\"", uri.c_str());
+ FormatDefault(player_domain, "played \"%s\"", uri.c_str());
}
ReplacePipe(dc.pipe);
diff --git a/src/UpdateArchive.cxx b/src/UpdateArchive.cxx
index 8e1936bb4..3139a5926 100644
--- a/src/UpdateArchive.cxx
+++ b/src/UpdateArchive.cxx
@@ -71,8 +71,8 @@ update_archive_tree(Directory &directory, const char *name)
db_unlock();
modified = true;
- FormatInfo(update_domain, "added %s/%s",
- directory.GetPath(), name);
+ FormatDefault(update_domain, "added %s/%s",
+ directory.GetPath(), name);
}
}
}
diff --git a/src/UpdateContainer.cxx b/src/UpdateContainer.cxx
index 3f658cbcc..80f059734 100644
--- a/src/UpdateContainer.cxx
+++ b/src/UpdateContainer.cxx
@@ -112,8 +112,8 @@ update_container_file(Directory &directory,
modified = true;
- FormatInfo(update_domain, "added %s/%s",
- directory.GetPath(), vtrack);
+ FormatDefault(update_domain, "added %s/%s",
+ directory.GetPath(), vtrack);
g_free(vtrack);
}
diff --git a/src/UpdateRemove.cxx b/src/UpdateRemove.cxx
index b8feefc6e..f4043b2f3 100644
--- a/src/UpdateRemove.cxx
+++ b/src/UpdateRemove.cxx
@@ -52,7 +52,7 @@ song_remove_event(void)
{
const auto uri = removed_song->GetURI();
- FormatInfo(update_domain, "removing %s", uri.c_str());
+ FormatDefault(update_domain, "removing %s", uri.c_str());
}
#ifdef ENABLE_SQLITE
diff --git a/src/UpdateSong.cxx b/src/UpdateSong.cxx
index ee0baaf6c..bfab5c4a0 100644
--- a/src/UpdateSong.cxx
+++ b/src/UpdateSong.cxx
@@ -83,11 +83,11 @@ update_song_file2(Directory &directory,
db_unlock();
modified = true;
- FormatInfo(update_domain, "added %s/%s",
- directory.GetPath(), name);
+ FormatDefault(update_domain, "added %s/%s",
+ directory.GetPath(), name);
} else if (st->st_mtime != song->mtime || walk_discard) {
- FormatInfo(update_domain, "updating %s/%s",
- directory.GetPath(), name);
+ FormatDefault(update_domain, "updating %s/%s",
+ directory.GetPath(), name);
if (!song->UpdateFile()) {
FormatDebug(update_domain,
"deleting unrecognized file %s/%s",
diff --git a/src/ZeroconfAvahi.cxx b/src/ZeroconfAvahi.cxx
index 7e044c030..083647b42 100644
--- a/src/ZeroconfAvahi.cxx
+++ b/src/ZeroconfAvahi.cxx
@@ -61,9 +61,9 @@ static void avahiGroupCallback(AvahiEntryGroup * g,
switch (state) {
case AVAHI_ENTRY_GROUP_ESTABLISHED:
/* The entry group has been established successfully */
- FormatInfo(avahi_domain,
- "Service '%s' successfully established.",
- avahiName);
+ FormatDefault(avahi_domain,
+ "Service '%s' successfully established.",
+ avahiName);
break;
case AVAHI_ENTRY_GROUP_COLLISION:
@@ -72,9 +72,9 @@ static void avahiGroupCallback(AvahiEntryGroup * g,
avahi_free(avahiName);
avahiName = n;
- FormatInfo(avahi_domain,
- "Service name collision, renaming service to '%s'",
- avahiName);
+ FormatDefault(avahi_domain,
+ "Service name collision, renaming service to '%s'",
+ avahiName);
/* And recreate the services */
avahiRegisterService(avahi_entry_group_get_client(g));
@@ -169,8 +169,8 @@ static void avahiClientCallback(AvahiClient * c, AvahiClientState state,
case AVAHI_CLIENT_FAILURE:
reason = avahi_client_errno(c);
if (reason == AVAHI_ERR_DISCONNECTED) {
- LogInfo(avahi_domain,
- "Client Disconnected, will reconnect shortly");
+ LogDefault(avahi_domain,
+ "Client Disconnected, will reconnect shortly");
if (avahiGroup) {
avahi_entry_group_free(avahiGroup);
avahiGroup = nullptr;
diff --git a/src/ZeroconfGlue.cxx b/src/ZeroconfGlue.cxx
index 24040d818..7c9c973cc 100644
--- a/src/ZeroconfGlue.cxx
+++ b/src/ZeroconfGlue.cxx
@@ -50,8 +50,8 @@ ZeroconfInit(gcc_unused EventLoop &loop)
return;
if (listen_port <= 0) {
- LogInfo(zeroconf_domain,
- "No global port, disabling zeroconf");
+ LogWarning(zeroconf_domain,
+ "No global port, disabling zeroconf");
zeroconfEnabled = false;
return;
}
diff --git a/src/decoder/FaadDecoderPlugin.cxx b/src/decoder/FaadDecoderPlugin.cxx
index e8b5ad4a8..f1dd5a343 100644
--- a/src/decoder/FaadDecoderPlugin.cxx
+++ b/src/decoder/FaadDecoderPlugin.cxx
@@ -427,17 +427,17 @@ faad_stream_decode(Decoder &mpd_decoder, InputStream &is)
}
if (frame_info.channels != audio_format.channels) {
- FormatInfo(faad_decoder_domain,
- "channel count changed from %u to %u",
- audio_format.channels, frame_info.channels);
+ FormatDefault(faad_decoder_domain,
+ "channel count changed from %u to %u",
+ audio_format.channels, frame_info.channels);
break;
}
if (frame_info.samplerate != audio_format.sample_rate) {
- FormatInfo(faad_decoder_domain,
- "sample rate changed from %u to %lu",
- audio_format.sample_rate,
- (unsigned long)frame_info.samplerate);
+ FormatDefault(faad_decoder_domain,
+ "sample rate changed from %u to %lu",
+ audio_format.sample_rate,
+ (unsigned long)frame_info.samplerate);
break;
}
diff --git a/src/decoder/FfmpegDecoderPlugin.cxx b/src/decoder/FfmpegDecoderPlugin.cxx
index 0d24371d2..1b62eae57 100644
--- a/src/decoder/FfmpegDecoderPlugin.cxx
+++ b/src/decoder/FfmpegDecoderPlugin.cxx
@@ -282,8 +282,8 @@ ffmpeg_send_packet(Decoder &decoder, InputStream &is,
if (len < 0) {
/* if error, we skip the frame */
- LogInfo(ffmpeg_domain,
- "decoding failed, frame skipped");
+ LogDefault(ffmpeg_domain,
+ "decoding failed, frame skipped");
break;
}
diff --git a/src/output/JackOutputPlugin.cxx b/src/output/JackOutputPlugin.cxx
index 75c7daf81..7ed672f95 100644
--- a/src/output/JackOutputPlugin.cxx
+++ b/src/output/JackOutputPlugin.cxx
@@ -221,7 +221,7 @@ mpd_jack_error(const char *msg)
static void
mpd_jack_info(const char *msg)
{
- LogInfo(jack_output_domain, msg);
+ LogDefault(jack_output_domain, msg);
}
#endif