Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
ecf12a60
Commit
ecf12a60
authored
Nov 04, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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".
parent
6de85cb0
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
72 additions
and
45 deletions
+72
-45
Log.cxx
src/Log.cxx
+12
-0
Log.hxx
src/Log.hxx
+15
-0
Main.cxx
src/Main.cxx
+8
-8
OutputInit.cxx
src/OutputInit.cxx
+7
-7
PlayerThread.cxx
src/PlayerThread.cxx
+1
-1
UpdateArchive.cxx
src/UpdateArchive.cxx
+2
-2
UpdateContainer.cxx
src/UpdateContainer.cxx
+2
-2
UpdateRemove.cxx
src/UpdateRemove.cxx
+1
-1
UpdateSong.cxx
src/UpdateSong.cxx
+4
-4
ZeroconfAvahi.cxx
src/ZeroconfAvahi.cxx
+8
-8
ZeroconfGlue.cxx
src/ZeroconfGlue.cxx
+2
-2
FaadDecoderPlugin.cxx
src/decoder/FaadDecoderPlugin.cxx
+7
-7
FfmpegDecoderPlugin.cxx
src/decoder/FfmpegDecoderPlugin.cxx
+2
-2
JackOutputPlugin.cxx
src/output/JackOutputPlugin.cxx
+1
-1
No files found.
src/Log.cxx
View file @
ecf12a60
...
@@ -51,6 +51,9 @@ ToGLib(LogLevel level)
...
@@ -51,6 +51,9 @@ ToGLib(LogLevel level)
return
G_LOG_LEVEL_DEBUG
;
return
G_LOG_LEVEL_DEBUG
;
case
LogLevel
:
:
INFO
:
case
LogLevel
:
:
INFO
:
return
G_LOG_LEVEL_INFO
;
case
LogLevel
:
:
DEFAULT
:
return
G_LOG_LEVEL_MESSAGE
;
return
G_LOG_LEVEL_MESSAGE
;
case
LogLevel
:
:
WARNING
:
case
LogLevel
:
:
WARNING
:
...
@@ -102,6 +105,15 @@ FormatInfo(const Domain &domain, const char *fmt, ...)
...
@@ -102,6 +105,15 @@ FormatInfo(const Domain &domain, const char *fmt, ...)
}
}
void
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
,
...)
FormatWarning
(
const
Domain
&
domain
,
const
char
*
fmt
,
...)
{
{
va_list
ap
;
va_list
ap
;
...
...
src/Log.hxx
View file @
ecf12a60
...
@@ -45,6 +45,11 @@ enum class LogLevel {
...
@@ -45,6 +45,11 @@ enum class LogLevel {
INFO
,
INFO
,
/**
/**
* Interesting informational message.
*/
DEFAULT
,
/**
* Warning: something may be wrong.
* Warning: something may be wrong.
*/
*/
WARNING
,
WARNING
,
...
@@ -84,6 +89,16 @@ void
...
@@ -84,6 +89,16 @@ void
FormatInfo
(
const
Domain
&
domain
,
const
char
*
fmt
,
...);
FormatInfo
(
const
Domain
&
domain
,
const
char
*
fmt
,
...);
static
inline
void
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
)
LogWarning
(
const
Domain
&
domain
,
const
char
*
msg
)
{
{
Log
(
domain
,
LogLevel
::
WARNING
,
msg
);
Log
(
domain
,
LogLevel
::
WARNING
,
msg
);
...
...
src/Main.cxx
View file @
ecf12a60
...
@@ -160,18 +160,18 @@ glue_db_init_and_load(void)
...
@@ -160,18 +160,18 @@ glue_db_init_and_load(void)
const
struct
config_param
*
path
=
config_get_param
(
CONF_DB_FILE
);
const
struct
config_param
*
path
=
config_get_param
(
CONF_DB_FILE
);
if
(
param
!=
nullptr
&&
path
!=
nullptr
)
if
(
param
!=
nullptr
&&
path
!=
nullptr
)
Log
Info
(
main_domain
,
Log
Warning
(
main_domain
,
"Found both 'database' and 'db_file' setting - ignoring the latter"
);
"Found both 'database' and 'db_file' setting - ignoring the latter"
);
if
(
!
mapper_has_music_directory
())
{
if
(
!
mapper_has_music_directory
())
{
if
(
param
!=
nullptr
)
if
(
param
!=
nullptr
)
Log
Info
(
main_domain
,
Log
Default
(
main_domain
,
"Found database setting without "
"Found database setting without "
"music_directory - disabling database"
);
"music_directory - disabling database"
);
if
(
path
!=
nullptr
)
if
(
path
!=
nullptr
)
Log
Info
(
main_domain
,
Log
Default
(
main_domain
,
"Found db_file setting without "
"Found db_file setting without "
"music_directory - disabling database"
);
"music_directory - disabling database"
);
return
true
;
return
true
;
}
}
...
...
src/OutputInit.cxx
View file @
ecf12a60
...
@@ -50,15 +50,15 @@
...
@@ -50,15 +50,15 @@
static
const
struct
audio_output_plugin
*
static
const
struct
audio_output_plugin
*
audio_output_detect
(
Error
&
error
)
audio_output_detect
(
Error
&
error
)
{
{
Log
Info
(
output_domain
,
"Attempt to detect audio output device"
);
Log
Default
(
output_domain
,
"Attempt to detect audio output device"
);
audio_output_plugins_for_each
(
plugin
)
{
audio_output_plugins_for_each
(
plugin
)
{
if
(
plugin
->
test_default_device
==
nullptr
)
if
(
plugin
->
test_default_device
==
nullptr
)
continue
;
continue
;
Format
Info
(
output_domain
,
Format
Default
(
output_domain
,
"Attempting to detect a %s audio device"
,
"Attempting to detect a %s audio device"
,
plugin
->
name
);
plugin
->
name
);
if
(
ao_plugin_test_default_device
(
plugin
))
if
(
ao_plugin_test_default_device
(
plugin
))
return
plugin
;
return
plugin
;
}
}
...
@@ -310,9 +310,9 @@ audio_output_new(const config_param ¶m,
...
@@ -310,9 +310,9 @@ audio_output_new(const config_param ¶m,
if
(
plugin
==
nullptr
)
if
(
plugin
==
nullptr
)
return
nullptr
;
return
nullptr
;
Format
Info
(
output_domain
,
Format
Default
(
output_domain
,
"Successfully detected a %s audio device"
,
"Successfully detected a %s audio device"
,
plugin
->
name
);
plugin
->
name
);
}
}
struct
audio_output
*
ao
=
ao_plugin_init
(
plugin
,
param
,
error
);
struct
audio_output
*
ao
=
ao_plugin_init
(
plugin
,
param
,
error
);
...
...
src/PlayerThread.cxx
View file @
ecf12a60
...
@@ -875,7 +875,7 @@ Player::SongBorder()
...
@@ -875,7 +875,7 @@ Player::SongBorder()
{
{
const
auto
uri
=
song
->
GetURI
();
const
auto
uri
=
song
->
GetURI
();
Format
Info
(
player_domain
,
"played
\"
%s
\"
"
,
uri
.
c_str
());
Format
Default
(
player_domain
,
"played
\"
%s
\"
"
,
uri
.
c_str
());
}
}
ReplacePipe
(
dc
.
pipe
);
ReplacePipe
(
dc
.
pipe
);
...
...
src/UpdateArchive.cxx
View file @
ecf12a60
...
@@ -71,8 +71,8 @@ update_archive_tree(Directory &directory, const char *name)
...
@@ -71,8 +71,8 @@ update_archive_tree(Directory &directory, const char *name)
db_unlock
();
db_unlock
();
modified
=
true
;
modified
=
true
;
Format
Info
(
update_domain
,
"added %s/%s"
,
Format
Default
(
update_domain
,
"added %s/%s"
,
directory
.
GetPath
(),
name
);
directory
.
GetPath
(),
name
);
}
}
}
}
}
}
...
...
src/UpdateContainer.cxx
View file @
ecf12a60
...
@@ -112,8 +112,8 @@ update_container_file(Directory &directory,
...
@@ -112,8 +112,8 @@ update_container_file(Directory &directory,
modified
=
true
;
modified
=
true
;
Format
Info
(
update_domain
,
"added %s/%s"
,
Format
Default
(
update_domain
,
"added %s/%s"
,
directory
.
GetPath
(),
vtrack
);
directory
.
GetPath
(),
vtrack
);
g_free
(
vtrack
);
g_free
(
vtrack
);
}
}
...
...
src/UpdateRemove.cxx
View file @
ecf12a60
...
@@ -52,7 +52,7 @@ song_remove_event(void)
...
@@ -52,7 +52,7 @@ song_remove_event(void)
{
{
const
auto
uri
=
removed_song
->
GetURI
();
const
auto
uri
=
removed_song
->
GetURI
();
Format
Info
(
update_domain
,
"removing %s"
,
uri
.
c_str
());
Format
Default
(
update_domain
,
"removing %s"
,
uri
.
c_str
());
}
}
#ifdef ENABLE_SQLITE
#ifdef ENABLE_SQLITE
...
...
src/UpdateSong.cxx
View file @
ecf12a60
...
@@ -83,11 +83,11 @@ update_song_file2(Directory &directory,
...
@@ -83,11 +83,11 @@ update_song_file2(Directory &directory,
db_unlock
();
db_unlock
();
modified
=
true
;
modified
=
true
;
Format
Info
(
update_domain
,
"added %s/%s"
,
Format
Default
(
update_domain
,
"added %s/%s"
,
directory
.
GetPath
(),
name
);
directory
.
GetPath
(),
name
);
}
else
if
(
st
->
st_mtime
!=
song
->
mtime
||
walk_discard
)
{
}
else
if
(
st
->
st_mtime
!=
song
->
mtime
||
walk_discard
)
{
Format
Info
(
update_domain
,
"updating %s/%s"
,
Format
Default
(
update_domain
,
"updating %s/%s"
,
directory
.
GetPath
(),
name
);
directory
.
GetPath
(),
name
);
if
(
!
song
->
UpdateFile
())
{
if
(
!
song
->
UpdateFile
())
{
FormatDebug
(
update_domain
,
FormatDebug
(
update_domain
,
"deleting unrecognized file %s/%s"
,
"deleting unrecognized file %s/%s"
,
...
...
src/ZeroconfAvahi.cxx
View file @
ecf12a60
...
@@ -61,9 +61,9 @@ static void avahiGroupCallback(AvahiEntryGroup * g,
...
@@ -61,9 +61,9 @@ static void avahiGroupCallback(AvahiEntryGroup * g,
switch
(
state
)
{
switch
(
state
)
{
case
AVAHI_ENTRY_GROUP_ESTABLISHED
:
case
AVAHI_ENTRY_GROUP_ESTABLISHED
:
/* The entry group has been established successfully */
/* The entry group has been established successfully */
Format
Info
(
avahi_domain
,
Format
Default
(
avahi_domain
,
"Service '%s' successfully established."
,
"Service '%s' successfully established."
,
avahiName
);
avahiName
);
break
;
break
;
case
AVAHI_ENTRY_GROUP_COLLISION
:
case
AVAHI_ENTRY_GROUP_COLLISION
:
...
@@ -72,9 +72,9 @@ static void avahiGroupCallback(AvahiEntryGroup * g,
...
@@ -72,9 +72,9 @@ static void avahiGroupCallback(AvahiEntryGroup * g,
avahi_free
(
avahiName
);
avahi_free
(
avahiName
);
avahiName
=
n
;
avahiName
=
n
;
Format
Info
(
avahi_domain
,
Format
Default
(
avahi_domain
,
"Service name collision, renaming service to '%s'"
,
"Service name collision, renaming service to '%s'"
,
avahiName
);
avahiName
);
/* And recreate the services */
/* And recreate the services */
avahiRegisterService
(
avahi_entry_group_get_client
(
g
));
avahiRegisterService
(
avahi_entry_group_get_client
(
g
));
...
@@ -169,8 +169,8 @@ static void avahiClientCallback(AvahiClient * c, AvahiClientState state,
...
@@ -169,8 +169,8 @@ static void avahiClientCallback(AvahiClient * c, AvahiClientState state,
case
AVAHI_CLIENT_FAILURE
:
case
AVAHI_CLIENT_FAILURE
:
reason
=
avahi_client_errno
(
c
);
reason
=
avahi_client_errno
(
c
);
if
(
reason
==
AVAHI_ERR_DISCONNECTED
)
{
if
(
reason
==
AVAHI_ERR_DISCONNECTED
)
{
Log
Info
(
avahi_domain
,
Log
Default
(
avahi_domain
,
"Client Disconnected, will reconnect shortly"
);
"Client Disconnected, will reconnect shortly"
);
if
(
avahiGroup
)
{
if
(
avahiGroup
)
{
avahi_entry_group_free
(
avahiGroup
);
avahi_entry_group_free
(
avahiGroup
);
avahiGroup
=
nullptr
;
avahiGroup
=
nullptr
;
...
...
src/ZeroconfGlue.cxx
View file @
ecf12a60
...
@@ -50,8 +50,8 @@ ZeroconfInit(gcc_unused EventLoop &loop)
...
@@ -50,8 +50,8 @@ ZeroconfInit(gcc_unused EventLoop &loop)
return
;
return
;
if
(
listen_port
<=
0
)
{
if
(
listen_port
<=
0
)
{
Log
Info
(
zeroconf_domain
,
Log
Warning
(
zeroconf_domain
,
"No global port, disabling zeroconf"
);
"No global port, disabling zeroconf"
);
zeroconfEnabled
=
false
;
zeroconfEnabled
=
false
;
return
;
return
;
}
}
...
...
src/decoder/FaadDecoderPlugin.cxx
View file @
ecf12a60
...
@@ -427,17 +427,17 @@ faad_stream_decode(Decoder &mpd_decoder, InputStream &is)
...
@@ -427,17 +427,17 @@ faad_stream_decode(Decoder &mpd_decoder, InputStream &is)
}
}
if
(
frame_info
.
channels
!=
audio_format
.
channels
)
{
if
(
frame_info
.
channels
!=
audio_format
.
channels
)
{
Format
Info
(
faad_decoder_domain
,
Format
Default
(
faad_decoder_domain
,
"channel count changed from %u to %u"
,
"channel count changed from %u to %u"
,
audio_format
.
channels
,
frame_info
.
channels
);
audio_format
.
channels
,
frame_info
.
channels
);
break
;
break
;
}
}
if
(
frame_info
.
samplerate
!=
audio_format
.
sample_rate
)
{
if
(
frame_info
.
samplerate
!=
audio_format
.
sample_rate
)
{
Format
Info
(
faad_decoder_domain
,
Format
Default
(
faad_decoder_domain
,
"sample rate changed from %u to %lu"
,
"sample rate changed from %u to %lu"
,
audio_format
.
sample_rate
,
audio_format
.
sample_rate
,
(
unsigned
long
)
frame_info
.
samplerate
);
(
unsigned
long
)
frame_info
.
samplerate
);
break
;
break
;
}
}
...
...
src/decoder/FfmpegDecoderPlugin.cxx
View file @
ecf12a60
...
@@ -282,8 +282,8 @@ ffmpeg_send_packet(Decoder &decoder, InputStream &is,
...
@@ -282,8 +282,8 @@ ffmpeg_send_packet(Decoder &decoder, InputStream &is,
if
(
len
<
0
)
{
if
(
len
<
0
)
{
/* if error, we skip the frame */
/* if error, we skip the frame */
Log
Info
(
ffmpeg_domain
,
Log
Default
(
ffmpeg_domain
,
"decoding failed, frame skipped"
);
"decoding failed, frame skipped"
);
break
;
break
;
}
}
...
...
src/output/JackOutputPlugin.cxx
View file @
ecf12a60
...
@@ -221,7 +221,7 @@ mpd_jack_error(const char *msg)
...
@@ -221,7 +221,7 @@ mpd_jack_error(const char *msg)
static
void
static
void
mpd_jack_info
(
const
char
*
msg
)
mpd_jack_info
(
const
char
*
msg
)
{
{
Log
Info
(
jack_output_domain
,
msg
);
Log
Default
(
jack_output_domain
,
msg
);
}
}
#endif
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment