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
15ed0982
Commit
15ed0982
authored
Feb 08, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
journal: add native logger module for the SystemD Journal
parent
4ea6b96b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
0 deletions
+104
-0
NEWS
NEWS
+1
-0
configure.ac
configure.ac
+10
-0
modules/logger/Makefile.am
modules/logger/Makefile.am
+7
-0
modules/logger/journal.c
modules/logger/journal.c
+86
-0
No files found.
NEWS
View file @
15ed0982
...
@@ -93,6 +93,7 @@ libVLC:
...
@@ -93,6 +93,7 @@ libVLC:
identifier (if there is one available)
identifier (if there is one available)
Logging
Logging
* Support for the SystemD Journal
* Use --syslog and --syslog-debug command line options to include debug
* Use --syslog and --syslog-debug command line options to include debug
messages in syslog. With --syslog, errors and warnings will be sent only.
messages in syslog. With --syslog, errors and warnings will be sent only.
...
...
configure.ac
View file @
15ed0982
...
@@ -868,6 +868,16 @@ AS_IF([test "${enable_dbus}" != "no"], [
...
@@ -868,6 +868,16 @@ AS_IF([test "${enable_dbus}" != "no"], [
])
])
AM_CONDITIONAL([HAVE_DBUS], [test "${have_dbus}" = "yes"])
AM_CONDITIONAL([HAVE_DBUS], [test "${have_dbus}" = "yes"])
dnl Check for systemd
PKG_CHECK_MODULES([SYSTEMD], [libsystemd], [
have_systemd="yes"
], [
AC_MSG_WARN([${SYSTEMD_PKG_ERRORS}.])
])
AM_CONDITIONAL([HAVE_SYSTEMD], [test "${have_systemd}" = "yes"])
dnl Check for ntohl, etc.
dnl Check for ntohl, etc.
VLC_SAVE_FLAGS
VLC_SAVE_FLAGS
CFLAGS="${CFLAGS} -Wall -Werror"
CFLAGS="${CFLAGS} -Wall -Werror"
...
...
modules/logger/Makefile.am
View file @
15ed0982
...
@@ -7,3 +7,10 @@ libsyslog_plugin_la_SOURCES = logger/syslog.c
...
@@ -7,3 +7,10 @@ libsyslog_plugin_la_SOURCES = logger/syslog.c
if
HAVE_SYSLOG
if
HAVE_SYSLOG
logger_LTLIBRARIES
+=
libsyslog_plugin.la
logger_LTLIBRARIES
+=
libsyslog_plugin.la
endif
endif
libsd_journal_plugin_la_SOURCES
=
logger/journal.c
libsd_journal_plugin_la_CPPFLAGS
=
$(AM_CPPFLAGS)
$(SYSTEMD_CFLAGS)
libsd_journal_plugin_la_LIBADD
=
$(SYSTEMD_LIBS)
if
HAVE_SYSTEMD
logger_LTLIBRARIES
+=
libsd_journal_plugin.la
endif
modules/logger/journal.c
0 → 100644
View file @
15ed0982
/*****************************************************************************
* journal.c: SystemD journal logger plugin
*****************************************************************************
* Copyright © 2015 Rémi Denis-Courmont
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdarg.h>
#include <inttypes.h>
#include <syslog.h>
#include <systemd/sd-journal.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
static
const
int
priorities
[
4
]
=
{
[
VLC_MSG_INFO
]
=
LOG_INFO
,
[
VLC_MSG_ERR
]
=
LOG_ERR
,
[
VLC_MSG_WARN
]
=
LOG_WARNING
,
[
VLC_MSG_DBG
]
=
LOG_DEBUG
,
};
static
void
Log
(
void
*
opaque
,
int
type
,
const
vlc_log_t
*
meta
,
const
char
*
format
,
va_list
ap
)
{
static
const
char
default_msg
[]
=
"message lost"
;
char
*
msg
;
int
canc
=
vlc_savecancel
();
if
(
vasprintf
(
&
msg
,
format
,
ap
)
==
-
1
)
msg
=
(
char
*
)
default_msg
;
sd_journal_send
(
"MESSAGE=%s"
,
msg
,
"PRIORITY=%d"
,
priorities
[
type
],
"CODE_FILE=%s"
,
(
meta
->
file
!=
NULL
)
?
meta
->
file
:
""
,
"CODE_LINE=%u"
,
meta
->
line
,
"CODE_FUNC=%s"
,
(
meta
->
func
!=
NULL
)
?
meta
->
func
:
""
,
//"ERRNO=%d"
"VLC_OBJECT_ID=%"
PRIxPTR
,
meta
->
i_object_id
,
"VLC_OBJECT_TYPE=%s"
,
meta
->
psz_object_type
,
"VLC_MODULE=%s"
,
meta
->
psz_module
,
"VLC_HEADER=%s"
,
(
meta
->
psz_header
!=
NULL
)
?
meta
->
psz_header
:
""
,
NULL
);
vlc_restorecancel
(
canc
);
if
(
msg
!=
default_msg
)
free
(
msg
);
(
void
)
opaque
;
}
static
vlc_log_cb
Open
(
vlc_object_t
*
obj
,
void
**
sysp
)
{
if
(
!
var_InheritBool
(
obj
,
"syslog"
))
return
NULL
;
(
void
)
sysp
;
return
Log
;
}
vlc_module_begin
()
set_shortname
(
N_
(
"Journal"
))
set_description
(
N_
(
"SystemD journal logger"
))
set_category
(
CAT_ADVANCED
)
set_subcategory
(
SUBCAT_ADVANCED_MISC
)
set_capability
(
"logger"
,
30
)
set_callbacks
(
Open
,
NULL
)
add_shortcut
(
"journal"
)
vlc_module_end
()
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