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
caf47f78
Commit
caf47f78
authored
Dec 28, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log: moved code to parse_log_level()
parent
5d2c59e3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
15 deletions
+17
-15
log.c
src/log.c
+17
-15
No files found.
src/log.c
View file @
caf47f78
...
...
@@ -101,6 +101,20 @@ open_log_file(void)
return
open
(
out_filename
,
O_CREAT
|
O_WRONLY
|
O_APPEND
,
0666
);
}
static
inline
GLogLevelFlags
parse_log_level
(
const
char
*
value
,
unsigned
line
)
{
if
(
0
==
strcmp
(
value
,
"default"
))
return
G_LOG_LEVEL_MESSAGE
;
if
(
0
==
strcmp
(
value
,
"secure"
))
return
LOG_LEVEL_SECURE
;
else
if
(
0
==
strcmp
(
value
,
"verbose"
))
return
G_LOG_LEVEL_DEBUG
;
else
FATAL
(
"unknown log level
\"
%s
\"
at line %u
\n
"
,
value
,
line
);
}
void
initLog
(
bool
verbose
)
{
ConfigParam
*
param
;
...
...
@@ -109,22 +123,10 @@ void initLog(bool verbose)
g_log_set_default_handler
(
mpd_log_func
,
NULL
);
if
(
verbose
)
{
log_threshold
=
G_LOG_LEVEL_DEBUG
;
return
;
}
if
(
!
(
param
=
getConfigParam
(
CONF_LOG_LEVEL
)))
return
;
if
(
0
==
strcmp
(
param
->
value
,
"default"
))
{
log_threshold
=
G_LOG_LEVEL_MESSAGE
;
}
else
if
(
0
==
strcmp
(
param
->
value
,
"secure"
))
{
log_threshold
=
LOG_LEVEL_SECURE
;
}
else
if
(
0
==
strcmp
(
param
->
value
,
"verbose"
))
{
if
(
verbose
)
log_threshold
=
G_LOG_LEVEL_DEBUG
;
}
else
{
FATAL
(
"unknown log level
\"
%s
\"
at line %i
\n
"
,
param
->
value
,
param
->
line
);
}
else
if
((
param
=
getConfigParam
(
CONF_LOG_LEVEL
))
!=
NULL
)
log_threshold
=
parse_log_level
(
param
->
value
,
param
->
line
);
}
void
open_log_files
(
bool
use_stdout
)
...
...
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