LogLevel: rename DEFAULT to NOTICE
"DEFAULT" is a bad name - all it says is that it's the default value, but it doesn't say what it means. The name NOTICE mimics the syslog level.
This commit is contained in:
parent
e3106a019d
commit
c843bce9f5
|
@ -83,12 +83,12 @@ log_level <default, secure, or verbose>
|
|||
|
||||
- :samp:`error`: errors
|
||||
- :samp:`warning`: warnings
|
||||
- :samp:`default`: interesting informational messages
|
||||
- :samp:`notice`: interesting informational messages
|
||||
- :samp:`info`: unimportant informational messages
|
||||
- :samp:`verbose`: debug messages (for developers and for
|
||||
troubleshooting)
|
||||
|
||||
The default is :samp:`default`.
|
||||
The default is :samp:`notice`.
|
||||
|
||||
follow_outside_symlinks <yes or no>
|
||||
Control if MPD will follow symbolic links pointing outside the music dir. You
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
# Suppress all messages below the given threshold. Use "verbose" for
|
||||
# troubleshooting.
|
||||
#
|
||||
#log_level "default"
|
||||
#log_level "notice"
|
||||
#
|
||||
# Setting "restore_paused" to "yes" puts MPD into pause mode instead
|
||||
# of starting playback after startup.
|
||||
|
|
|
@ -65,11 +65,11 @@ FormatInfo(const Domain &domain, const char *fmt, ...) noexcept
|
|||
}
|
||||
|
||||
void
|
||||
FormatDefault(const Domain &domain, const char *fmt, ...) noexcept
|
||||
FormatNotice(const Domain &domain, const char *fmt, ...) noexcept
|
||||
{
|
||||
std::va_list ap;
|
||||
va_start(ap, fmt);
|
||||
LogFormatV(LogLevel::DEFAULT, domain, fmt, ap);
|
||||
LogFormatV(LogLevel::NOTICE, domain, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
|
|
|
@ -77,14 +77,14 @@ void
|
|||
FormatInfo(const Domain &domain, const char *fmt, ...) noexcept;
|
||||
|
||||
static inline void
|
||||
LogDefault(const Domain &domain, const char *msg) noexcept
|
||||
LogNotice(const Domain &domain, const char *msg) noexcept
|
||||
{
|
||||
Log(LogLevel::DEFAULT, domain, msg);
|
||||
Log(LogLevel::NOTICE, domain, msg);
|
||||
}
|
||||
|
||||
gcc_printf(2,3)
|
||||
void
|
||||
FormatDefault(const Domain &domain, const char *fmt, ...) noexcept;
|
||||
FormatNotice(const Domain &domain, const char *fmt, ...) noexcept;
|
||||
|
||||
static inline void
|
||||
LogWarning(const Domain &domain, const char *msg) noexcept
|
||||
|
|
|
@ -47,7 +47,7 @@ ToAndroidLogLevel(LogLevel log_level) noexcept
|
|||
return ANDROID_LOG_DEBUG;
|
||||
|
||||
case LogLevel::INFO:
|
||||
case LogLevel::DEFAULT:
|
||||
case LogLevel::NOTICE:
|
||||
return ANDROID_LOG_INFO;
|
||||
|
||||
case LogLevel::WARNING:
|
||||
|
@ -63,7 +63,7 @@ ToAndroidLogLevel(LogLevel log_level) noexcept
|
|||
|
||||
#else
|
||||
|
||||
static LogLevel log_threshold = LogLevel::DEFAULT;
|
||||
static LogLevel log_threshold = LogLevel::NOTICE;
|
||||
|
||||
static bool enable_timestamp;
|
||||
|
||||
|
@ -122,7 +122,7 @@ ToSysLogLevel(LogLevel log_level) noexcept
|
|||
case LogLevel::INFO:
|
||||
return LOG_INFO;
|
||||
|
||||
case LogLevel::DEFAULT:
|
||||
case LogLevel::NOTICE:
|
||||
return LOG_NOTICE;
|
||||
|
||||
case LogLevel::WARNING:
|
||||
|
|
|
@ -95,8 +95,10 @@ log_init_file(int line)
|
|||
static inline LogLevel
|
||||
parse_log_level(const char *value)
|
||||
{
|
||||
if (StringIsEqual(value, "default"))
|
||||
return LogLevel::DEFAULT;
|
||||
if (StringIsEqual(value, "notice") ||
|
||||
/* deprecated name: */
|
||||
StringIsEqual(value, "default"))
|
||||
return LogLevel::NOTICE;
|
||||
else if (StringIsEqual(value, "info") ||
|
||||
/* deprecated since MPD 0.22: */
|
||||
StringIsEqual(value, "secure"))
|
||||
|
@ -141,7 +143,7 @@ log_init(const ConfigData &config, bool verbose, bool use_stdout)
|
|||
SetLogThreshold(config.With(ConfigOption::LOG_LEVEL, [](const char *s){
|
||||
return s != nullptr
|
||||
? parse_log_level(s)
|
||||
: LogLevel::DEFAULT;
|
||||
: LogLevel::NOTICE;
|
||||
}));
|
||||
|
||||
if (use_stdout) {
|
||||
|
|
|
@ -42,7 +42,7 @@ enum class LogLevel {
|
|||
/**
|
||||
* Interesting informational message.
|
||||
*/
|
||||
DEFAULT,
|
||||
NOTICE,
|
||||
|
||||
/**
|
||||
* Warning: something may be wrong.
|
||||
|
|
12
src/Main.cxx
12
src/Main.cxx
|
@ -194,16 +194,16 @@ glue_db_init_and_load(Instance &instance, const ConfigData &config)
|
|||
config);
|
||||
|
||||
if (instance.storage == nullptr) {
|
||||
LogDefault(config_domain,
|
||||
"Found database setting without "
|
||||
"music_directory - disabling database");
|
||||
LogNotice(config_domain,
|
||||
"Found database setting without "
|
||||
"music_directory - disabling database");
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (IsStorageConfigured(config))
|
||||
LogDefault(config_domain,
|
||||
"Ignoring the storage configuration "
|
||||
"because the database does not need it");
|
||||
LogNotice(config_domain,
|
||||
"Ignoring the storage configuration "
|
||||
"because the database does not need it");
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
|
@ -82,8 +82,8 @@ UpdateWalk::UpdateArchiveTree(ArchiveFile &archive, Directory &directory,
|
|||
}
|
||||
|
||||
modified = true;
|
||||
FormatDefault(update_domain, "added %s/%s",
|
||||
directory.GetPath(), name);
|
||||
FormatNotice(update_domain, "added %s/%s",
|
||||
directory.GetPath(), name);
|
||||
}
|
||||
} else {
|
||||
if (!song->UpdateFileInArchive(archive)) {
|
||||
|
|
|
@ -75,9 +75,9 @@ UpdateWalk::UpdateContainerFile(Directory &directory,
|
|||
// shouldn't be necessary but it's there..
|
||||
song->mtime = info.mtime;
|
||||
|
||||
FormatDefault(update_domain, "added %s/%s",
|
||||
contdir->GetPath(),
|
||||
song->filename.c_str());
|
||||
FormatNotice(update_domain, "added %s/%s",
|
||||
contdir->GetPath(),
|
||||
song->filename.c_str());
|
||||
|
||||
{
|
||||
const ScopeDatabaseLock protect;
|
||||
|
|
|
@ -41,7 +41,7 @@ UpdateRemoveService::RunDeferred() noexcept
|
|||
}
|
||||
|
||||
for (const auto &uri : copy) {
|
||||
FormatDefault(update_domain, "removing %s", uri.c_str());
|
||||
FormatNotice(update_domain, "removing %s", uri.c_str());
|
||||
listener.OnDatabaseSongRemoved(uri.c_str());
|
||||
}
|
||||
|
||||
|
|
|
@ -76,11 +76,11 @@ try {
|
|||
}
|
||||
|
||||
modified = true;
|
||||
FormatDefault(update_domain, "added %s/%s",
|
||||
directory.GetPath(), name);
|
||||
FormatNotice(update_domain, "added %s/%s",
|
||||
directory.GetPath(), name);
|
||||
} else if (info.mtime != song->mtime || walk_discard) {
|
||||
FormatDefault(update_domain, "updating %s/%s",
|
||||
directory.GetPath(), name);
|
||||
FormatNotice(update_domain, "updating %s/%s",
|
||||
directory.GetPath(), name);
|
||||
if (!song->UpdateFile(storage)) {
|
||||
FormatDebug(update_domain,
|
||||
"deleting unrecognized file %s/%s",
|
||||
|
|
|
@ -364,17 +364,17 @@ faad_stream_decode(DecoderClient &client, InputStream &is,
|
|||
}
|
||||
|
||||
if (frame_info.channels != audio_format.channels) {
|
||||
FormatDefault(faad_decoder_domain,
|
||||
"channel count changed from %u to %u",
|
||||
audio_format.channels, frame_info.channels);
|
||||
FormatNotice(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) {
|
||||
FormatDefault(faad_decoder_domain,
|
||||
"sample rate changed from %u to %lu",
|
||||
audio_format.sample_rate,
|
||||
(unsigned long)frame_info.samplerate);
|
||||
FormatNotice(faad_decoder_domain,
|
||||
"sample rate changed from %u to %lu",
|
||||
audio_format.sample_rate,
|
||||
(unsigned long)frame_info.samplerate);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,15 +62,15 @@ FilteredAudioOutput::FilteredAudioOutput(const char *_plugin_name,
|
|||
static const AudioOutputPlugin *
|
||||
audio_output_detect()
|
||||
{
|
||||
LogDefault(output_domain, "Attempt to detect audio output device");
|
||||
LogInfo(output_domain, "Attempt to detect audio output device");
|
||||
|
||||
audio_output_plugins_for_each(plugin) {
|
||||
if (plugin->test_default_device == nullptr)
|
||||
continue;
|
||||
|
||||
FormatDefault(output_domain,
|
||||
"Attempting to detect a %s audio device",
|
||||
plugin->name);
|
||||
FormatInfo(output_domain,
|
||||
"Attempting to detect a %s audio device",
|
||||
plugin->name);
|
||||
if (ao_plugin_test_default_device(plugin))
|
||||
return plugin;
|
||||
}
|
||||
|
@ -289,9 +289,9 @@ audio_output_new(EventLoop &event_loop,
|
|||
|
||||
plugin = audio_output_detect();
|
||||
|
||||
FormatDefault(output_domain,
|
||||
"Successfully detected a %s audio device",
|
||||
plugin->name);
|
||||
FormatNotice(output_domain,
|
||||
"Successfully detected a %s audio device",
|
||||
plugin->name);
|
||||
}
|
||||
|
||||
std::unique_ptr<AudioOutput> ao(ao_plugin_init(event_loop, *plugin,
|
||||
|
|
|
@ -376,7 +376,7 @@ mpd_jack_error(const char *msg)
|
|||
static void
|
||||
mpd_jack_info(const char *msg)
|
||||
{
|
||||
LogDefault(jack_output_domain, msg);
|
||||
LogNotice(jack_output_domain, msg);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -322,8 +322,8 @@ void WasapiOutput::Enable() {
|
|||
|
||||
if (enumerate_devices && SafeTry([this]() { EnumerateDevices(); })) {
|
||||
for (const auto &desc : device_desc) {
|
||||
FormatDefault(wasapi_output_domain, "Device \"%u\" \"%s\"",
|
||||
desc.first, desc.second.c_str());
|
||||
FormatNotice(wasapi_output_domain, "Device \"%u\" \"%s\"",
|
||||
desc.first, desc.second.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -964,7 +964,7 @@ Player::SongBorder() noexcept
|
|||
{
|
||||
const ScopeUnlock unlock(pc.mutex);
|
||||
|
||||
FormatDefault(player_domain, "played \"%s\"", song->GetURI());
|
||||
FormatNotice(player_domain, "played \"%s\"", song->GetURI());
|
||||
|
||||
ReplacePipe(dc.pipe);
|
||||
|
||||
|
@ -1135,7 +1135,7 @@ Player::Run() noexcept
|
|||
cross_fade_tag.reset();
|
||||
|
||||
if (song != nullptr) {
|
||||
FormatDefault(player_domain, "played \"%s\"", song->GetURI());
|
||||
FormatNotice(player_domain, "played \"%s\"", song->GetURI());
|
||||
song.reset();
|
||||
}
|
||||
|
||||
|
|
|
@ -59,9 +59,9 @@ AvahiGroupCallback(AvahiEntryGroup *g,
|
|||
switch (state) {
|
||||
case AVAHI_ENTRY_GROUP_ESTABLISHED:
|
||||
/* The entry group has been established successfully */
|
||||
FormatDefault(avahi_domain,
|
||||
"Service '%s' successfully established.",
|
||||
avahi_name);
|
||||
FormatNotice(avahi_domain,
|
||||
"Service '%s' successfully established.",
|
||||
avahi_name);
|
||||
break;
|
||||
|
||||
case AVAHI_ENTRY_GROUP_COLLISION:
|
||||
|
@ -72,9 +72,9 @@ AvahiGroupCallback(AvahiEntryGroup *g,
|
|||
avahi_name = n;
|
||||
}
|
||||
|
||||
FormatDefault(avahi_domain,
|
||||
"Service name collision, renaming service to '%s'",
|
||||
avahi_name);
|
||||
FormatNotice(avahi_domain,
|
||||
"Service name collision, renaming service to '%s'",
|
||||
avahi_name);
|
||||
|
||||
/* And recreate the services */
|
||||
AvahiRegisterService(avahi_entry_group_get_client(g));
|
||||
|
@ -171,8 +171,8 @@ MyAvahiClientCallback(AvahiClient *c, AvahiClientState state,
|
|||
case AVAHI_CLIENT_FAILURE:
|
||||
reason = avahi_client_errno(c);
|
||||
if (reason == AVAHI_ERR_DISCONNECTED) {
|
||||
LogDefault(avahi_domain,
|
||||
"Client Disconnected, will reconnect shortly");
|
||||
LogNotice(avahi_domain,
|
||||
"Client Disconnected, will reconnect shortly");
|
||||
if (avahi_group != nullptr) {
|
||||
avahi_entry_group_free(avahi_group);
|
||||
avahi_group = nullptr;
|
||||
|
|
Loading…
Reference in New Issue