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
e0d5d881
Commit
e0d5d881
authored
May 22, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Log: make LogLevel the first parameter
Prepare for templated functions.
parent
585a7454
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
29 additions
and
29 deletions
+29
-29
Log.cxx
src/Log.cxx
+11
-11
Log.hxx
src/Log.hxx
+8
-8
LogBackend.cxx
src/LogBackend.cxx
+2
-2
LogBackend.hxx
src/LogBackend.hxx
+1
-1
LogV.hxx
src/LogV.hxx
+2
-2
FluidsynthDecoderPlugin.cxx
src/decoder/plugins/FluidsynthDecoderPlugin.cxx
+2
-2
LogCallback.cxx
src/lib/ffmpeg/LogCallback.cxx
+1
-1
FatalError.cxx
src/system/FatalError.cxx
+1
-1
test_translate_song.cxx
test/test_translate_song.cxx
+1
-1
No files found.
src/Log.cxx
View file @
e0d5d881
/*
* Copyright 2003-201
8
The Music Player Daemon Project
* Copyright 2003-201
9
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -28,20 +28,20 @@
static
constexpr
Domain
exception_domain
(
"exception"
);
void
LogFormatV
(
const
Domain
&
domain
,
LogLevel
level
,
LogFormatV
(
LogLevel
level
,
const
Domain
&
domain
,
const
char
*
fmt
,
va_list
ap
)
noexcept
{
char
msg
[
1024
];
vsnprintf
(
msg
,
sizeof
(
msg
),
fmt
,
ap
);
Log
(
domain
,
level
,
msg
);
Log
(
level
,
domain
,
msg
);
}
void
LogFormat
(
const
Domain
&
domain
,
LogLevel
level
,
const
char
*
fmt
,
...)
noexcept
LogFormat
(
LogLevel
level
,
const
Domain
&
domain
,
const
char
*
fmt
,
...)
noexcept
{
va_list
ap
;
va_start
(
ap
,
fmt
);
LogFormatV
(
domain
,
level
,
fmt
,
ap
);
LogFormatV
(
level
,
domain
,
fmt
,
ap
);
va_end
(
ap
);
}
...
...
@@ -50,7 +50,7 @@ FormatDebug(const Domain &domain, const char *fmt, ...) noexcept
{
va_list
ap
;
va_start
(
ap
,
fmt
);
LogFormatV
(
domain
,
LogLevel
::
DEBUG
,
fmt
,
ap
);
LogFormatV
(
LogLevel
::
DEBUG
,
domain
,
fmt
,
ap
);
va_end
(
ap
);
}
...
...
@@ -59,7 +59,7 @@ FormatInfo(const Domain &domain, const char *fmt, ...) noexcept
{
va_list
ap
;
va_start
(
ap
,
fmt
);
LogFormatV
(
domain
,
LogLevel
::
INFO
,
fmt
,
ap
);
LogFormatV
(
LogLevel
::
INFO
,
domain
,
fmt
,
ap
);
va_end
(
ap
);
}
...
...
@@ -68,7 +68,7 @@ FormatDefault(const Domain &domain, const char *fmt, ...) noexcept
{
va_list
ap
;
va_start
(
ap
,
fmt
);
LogFormatV
(
domain
,
LogLevel
::
DEFAULT
,
fmt
,
ap
);
LogFormatV
(
LogLevel
::
DEFAULT
,
domain
,
fmt
,
ap
);
va_end
(
ap
);
}
...
...
@@ -77,7 +77,7 @@ FormatWarning(const Domain &domain, const char *fmt, ...) noexcept
{
va_list
ap
;
va_start
(
ap
,
fmt
);
LogFormatV
(
domain
,
LogLevel
::
WARNING
,
fmt
,
ap
);
LogFormatV
(
LogLevel
::
WARNING
,
domain
,
fmt
,
ap
);
va_end
(
ap
);
}
...
...
@@ -86,7 +86,7 @@ FormatError(const Domain &domain, const char *fmt, ...) noexcept
{
va_list
ap
;
va_start
(
ap
,
fmt
);
LogFormatV
(
domain
,
LogLevel
::
ERROR
,
fmt
,
ap
);
LogFormatV
(
LogLevel
::
ERROR
,
domain
,
fmt
,
ap
);
va_end
(
ap
);
}
...
...
@@ -142,7 +142,7 @@ FormatError(const std::exception_ptr &ep, const char *fmt, ...) noexcept
void
LogErrno
(
const
Domain
&
domain
,
int
e
,
const
char
*
msg
)
noexcept
{
LogFormat
(
domain
,
LogLevel
::
ERROR
,
"%s: %s"
,
msg
,
strerror
(
e
));
LogFormat
(
LogLevel
::
ERROR
,
domain
,
"%s: %s"
,
msg
,
strerror
(
e
));
}
void
...
...
src/Log.hxx
View file @
e0d5d881
/*
* Copyright 2003-201
8
The Music Player Daemon Project
* Copyright 2003-201
9
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -28,16 +28,16 @@
class
Domain
;
void
Log
(
const
Domain
&
domain
,
LogLevel
level
,
const
char
*
msg
)
noexcept
;
Log
(
LogLevel
level
,
const
Domain
&
domain
,
const
char
*
msg
)
noexcept
;
gcc_printf
(
3
,
4
)
void
LogFormat
(
const
Domain
&
domain
,
LogLevel
level
,
const
char
*
fmt
,
...)
noexcept
;
LogFormat
(
LogLevel
level
,
const
Domain
&
domain
,
const
char
*
fmt
,
...)
noexcept
;
static
inline
void
LogDebug
(
const
Domain
&
domain
,
const
char
*
msg
)
noexcept
{
Log
(
domain
,
LogLevel
::
DEBUG
,
msg
);
Log
(
LogLevel
::
DEBUG
,
domain
,
msg
);
}
gcc_printf
(
2
,
3
)
...
...
@@ -47,7 +47,7 @@ FormatDebug(const Domain &domain, const char *fmt, ...) noexcept;
static
inline
void
LogInfo
(
const
Domain
&
domain
,
const
char
*
msg
)
noexcept
{
Log
(
domain
,
LogLevel
::
INFO
,
msg
);
Log
(
LogLevel
::
INFO
,
domain
,
msg
);
}
gcc_printf
(
2
,
3
)
...
...
@@ -57,7 +57,7 @@ FormatInfo(const Domain &domain, const char *fmt, ...) noexcept;
static
inline
void
LogDefault
(
const
Domain
&
domain
,
const
char
*
msg
)
noexcept
{
Log
(
domain
,
LogLevel
::
DEFAULT
,
msg
);
Log
(
LogLevel
::
DEFAULT
,
domain
,
msg
);
}
gcc_printf
(
2
,
3
)
...
...
@@ -67,7 +67,7 @@ FormatDefault(const Domain &domain, const char *fmt, ...) noexcept;
static
inline
void
LogWarning
(
const
Domain
&
domain
,
const
char
*
msg
)
noexcept
{
Log
(
domain
,
LogLevel
::
WARNING
,
msg
);
Log
(
LogLevel
::
WARNING
,
domain
,
msg
);
}
gcc_printf
(
2
,
3
)
...
...
@@ -77,7 +77,7 @@ FormatWarning(const Domain &domain, const char *fmt, ...) noexcept;
static
inline
void
LogError
(
const
Domain
&
domain
,
const
char
*
msg
)
noexcept
{
Log
(
domain
,
LogLevel
::
ERROR
,
msg
);
Log
(
LogLevel
::
ERROR
,
domain
,
msg
);
}
void
...
...
src/LogBackend.cxx
View file @
e0d5d881
/*
* Copyright 2003-201
8
The Music Player Daemon Project
* Copyright 2003-201
9
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -176,7 +176,7 @@ FileLog(const Domain &domain, const char *message) noexcept
#endif
/* !ANDROID */
void
Log
(
const
Domain
&
domain
,
LogLevel
level
,
const
char
*
msg
)
noexcept
Log
(
LogLevel
level
,
const
Domain
&
domain
,
const
char
*
msg
)
noexcept
{
#ifdef ANDROID
__android_log_print
(
ToAndroidLogLevel
(
level
),
"MPD"
,
...
...
src/LogBackend.hxx
View file @
e0d5d881
/*
* Copyright 2003-201
8
The Music Player Daemon Project
* Copyright 2003-201
9
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
src/LogV.hxx
View file @
e0d5d881
/*
* Copyright 2003-201
8
The Music Player Daemon Project
* Copyright 2003-201
9
The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
...
...
@@ -25,7 +25,7 @@
#include <stdarg.h>
void
LogFormatV
(
const
Domain
&
domain
,
LogLevel
level
,
LogFormatV
(
LogLevel
level
,
const
Domain
&
domain
,
const
char
*
fmt
,
va_list
ap
)
noexcept
;
#endif
/* LOG_H */
src/decoder/plugins/FluidsynthDecoderPlugin.cxx
View file @
e0d5d881
...
...
@@ -70,8 +70,8 @@ fluidsynth_mpd_log_function(int level,
char
*
message
,
void
*
)
{
Log
(
fluidsynth_
domain
,
fluidsynth_
level_to_mpd
(
fluid_log_level
(
level
))
,
Log
(
fluidsynth_
level_to_mpd
(
fluid_log_level
(
level
))
,
fluidsynth_
domain
,
message
);
}
...
...
src/lib/ffmpeg/LogCallback.cxx
View file @
e0d5d881
...
...
@@ -62,6 +62,6 @@ FfmpegLogCallback(gcc_unused void *ptr, int level, const char *fmt, va_list vl)
ffmpeg_domain
.
GetName
(),
cls
->
item_name
(
ptr
));
const
Domain
d
(
domain
);
LogFormatV
(
d
,
FfmpegImportLogLevel
(
level
)
,
fmt
,
vl
);
LogFormatV
(
FfmpegImportLogLevel
(
level
),
d
,
fmt
,
vl
);
}
}
src/system/FatalError.cxx
View file @
e0d5d881
...
...
@@ -54,7 +54,7 @@ FormatFatalError(const char *fmt, ...)
{
va_list
ap
;
va_start
(
ap
,
fmt
);
LogFormatV
(
fatal_error_domain
,
LogLevel
::
ERROR
,
fmt
,
ap
);
LogFormatV
(
LogLevel
::
ERROR
,
fatal_error_domain
,
fmt
,
ap
);
va_end
(
ap
);
Abort
();
...
...
test/test_translate_song.cxx
View file @
e0d5d881
...
...
@@ -25,7 +25,7 @@
#include <stdio.h>
void
Log
(
const
Domain
&
domain
,
gcc_unused
LogLevel
level
,
const
char
*
msg
)
noexcept
Log
(
LogLevel
,
const
Domain
&
domain
,
const
char
*
msg
)
noexcept
{
fprintf
(
stderr
,
"[%s] %s
\n
"
,
domain
.
GetName
(),
msg
);
}
...
...
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