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
4c967a6b
Commit
4c967a6b
authored
Nov 05, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
log: provide a GLib logging handler
Install a default handler which writes to stdout or stderr, and prepends a time stamp. This looks just like the 0.13.x logger.
parent
a5348a37
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
0 deletions
+15
-0
log.c
src/log.c
+15
-0
No files found.
src/log.c
View file @
4c967a6b
...
...
@@ -64,10 +64,25 @@ static const char *log_date(void)
return
buf
;
}
static
void
mpd_log_func
(
G_GNUC_UNUSED
const
gchar
*
log_domain
,
G_GNUC_UNUSED
GLogLevelFlags
log_level
,
const
gchar
*
message
,
G_GNUC_UNUSED
gpointer
user_data
)
{
FILE
*
file
=
log_level
<=
G_LOG_LEVEL_WARNING
?
stderr
:
stdout
;
fprintf
(
file
,
"%s%s"
,
stdout_mode
?
""
:
log_date
(),
message
);
}
void
initLog
(
const
int
verbose
)
{
ConfigParam
*
param
;
g_log_set_default_handler
(
mpd_log_func
,
NULL
);
/* unbuffer stdout, stderr is unbuffered by default, leave it */
setvbuf
(
stdout
,
(
char
*
)
NULL
,
_IONBF
,
0
);
...
...
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