Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
d4dd8761
Commit
d4dd8761
authored
Apr 19, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libvlc: helper to log to a FILE
parent
f7260e64
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletion
+31
-1
include/vlc/libvlc.h
include/vlc/libvlc.h
+12
-1
lib/log.c
lib/log.c
+19
-0
No files found.
include/vlc/libvlc.h
View file @
d4dd8761
...
@@ -56,11 +56,13 @@
...
@@ -56,11 +56,13 @@
# define LIBVLC_DEPRECATED
# define LIBVLC_DEPRECATED
#endif
#endif
#include <stdio.h>
#include <stdarg.h>
# ifdef __cplusplus
# ifdef __cplusplus
extern
"C"
{
extern
"C"
{
# endif
# endif
#include <stdarg.h>
#include <vlc/libvlc_structures.h>
#include <vlc/libvlc_structures.h>
/** \defgroup libvlc_core LibVLC core
/** \defgroup libvlc_core LibVLC core
...
@@ -370,6 +372,15 @@ typedef struct libvlc_log_subscriber
...
@@ -370,6 +372,15 @@ typedef struct libvlc_log_subscriber
LIBVLC_API
void
libvlc_log_subscribe
(
libvlc_log_subscriber_t
*
sub
,
LIBVLC_API
void
libvlc_log_subscribe
(
libvlc_log_subscriber_t
*
sub
,
libvlc_log_cb
cb
,
void
*
data
);
libvlc_log_cb
cb
,
void
*
data
);
/**
* Registers a logging callback to a file.
* @param stream FILE pointer opened for writing
* (the FILE pointer must remain valid until libvlc_log_unsubscribe())
*/
LIBVLC_API
void
libvlc_log_subscribe_file
(
libvlc_log_subscriber_t
*
sub
,
FILE
*
stream
);
/**
/**
* Deregisters a logging callback from LibVLC.
* Deregisters a logging callback from LibVLC.
* This function is thread-safe.
* This function is thread-safe.
...
...
lib/log.c
View file @
d4dd8761
...
@@ -113,6 +113,25 @@ void libvlc_log_unsubscribe( libvlc_log_subscriber_t *sub )
...
@@ -113,6 +113,25 @@ void libvlc_log_unsubscribe( libvlc_log_subscriber_t *sub )
vlc_rwlock_unlock
(
&
log_lock
);
vlc_rwlock_unlock
(
&
log_lock
);
}
}
/*** Helpers for logging to files ***/
static
void
libvlc_log_file
(
void
*
data
,
int
level
,
const
char
*
fmt
,
va_list
ap
)
{
FILE
*
stream
=
data
;
flockfile
(
stream
);
vfprintf
(
stream
,
fmt
,
ap
);
fputc
(
'\n'
,
stream
);
funlockfile
(
stream
);
(
void
)
level
;
}
void
libvlc_log_subscribe_file
(
libvlc_log_subscriber_t
*
sub
,
FILE
*
stream
)
{
libvlc_log_subscribe
(
sub
,
libvlc_log_file
,
stream
);
}
/*** Stubs for the old interface ***/
unsigned
libvlc_get_log_verbosity
(
const
libvlc_instance_t
*
p_instance
)
unsigned
libvlc_get_log_verbosity
(
const
libvlc_instance_t
*
p_instance
)
{
{
(
void
)
p_instance
;
(
void
)
p_instance
;
...
...
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