This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project wmaker-crm.git.
The branch, next has been updated
discards 320430efe5642db07c82d75a6e6311065233d622 (commit)
via 4a17aa58626ba27d56fe5a5cbdff3b415c2464b3 (commit)
This update added new revisions after undoing existing revisions. That is
to say, the old revision is not a strict subset of the new revision. This
situation occurs when you --force push a change and generate a repository
containing something like this:
* -- * -- B -- O -- O -- O (320430efe5642db07c82d75a6e6311065233d622)
N -- N -- N (4a17aa58626ba27d56fe5a5cbdff3b415c2464b3)
When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/wmaker-crm.git/commit/4a17aa58626ba27d56fe5a5cbdff3b415c2464b3
commit 4a17aa58626ba27d56fe5a5cbdff3b415c2464b3
Author: David Maciejak <[email protected]>
Date: Thu Feb 13 19:04:41 2014 +0800
WINGs: Add support for syslog messaging
This patch is used to add support for syslog messaging implemented in
WINGs lib directly, so available from the lib itself and wmaker too.
I believe it will in a first time help to get some logging info
centralized in one point, and in a second time maybe add some info
level messages like wmaker is starting, stopping, restarting and else.
For now, it's built by default when the syslog support is found, maybe
we could also disable it by default.
diff --git a/WINGs/WINGs/WUtil.h b/WINGs/WINGs/WUtil.h
index 246ef2d1..b2e76ab2 100644
--- a/WINGs/WINGs/WUtil.h
+++ b/WINGs/WINGs/WUtil.h
@@ -243,6 +243,9 @@ enum {
void __wmessage(const char *func, const char *file, int line, int type, const
char *msg, ...)
__attribute__((__format__(printf,5,6)));
+void syslog_shutdown(void);
+
+
/* ---[ WINGs/findfile.c ]------------------------------------------------ */
/* For the 4 function below, you have to free the returned string when you no
longer need it */
diff --git a/WINGs/error.c b/WINGs/error.c
index 2d5a5881..61c3cc06 100644
--- a/WINGs/error.c
+++ b/WINGs/error.c
@@ -30,6 +30,51 @@
#include <WUtil.h>
#include <WINGsP.h>
+#ifdef HAVE_SYSLOG_H
+#include <syslog.h>
+static Bool syslog_initialized = False;
+#endif
+
+void syslog_open(char *prog_name)
+{
+#ifdef HAVE_SYSLOG
+ int options;
+
+ if (!prog_name)
+ prog_name = "WINGs";
+
+ options = LOG_PID;
+ openlog(prog_name, options, LOG_DAEMON);
+ syslog_initialized = True;
+#else
+ (void) prog_name;
+#endif
+}
+
+void syslog_message(int prio, char *prog_name, char *msg)
+{
+#ifdef HAVE_SYSLOG
+ if (!syslog_initialized)
+ syslog_open(prog_name);
+
+ //jump over the program name cause syslog is already displaying it
+ syslog(prio, "%s", msg+strlen(prog_name));
+#else
+ (void) prio;
+ (void) prog_name;
+ (void) msg;
+#endif
+}
+
+void syslog_shutdown(void)
+{
+#ifdef HAVE_SYSLOG
+ if (syslog_initialized) {
+ closelog();
+ syslog_initialized = False;
+ }
+#endif
+}
void __wmessage(const char *func, const char *file, int line, int type, const
char *msg, ...)
{
@@ -37,6 +82,10 @@ void __wmessage(const char *func, const char *file, int
line, int type, const ch
char *buf;
static int linemax = 0;
int truncated = 0;
+#ifdef HAVE_SYSLOG
+ int syslog_priority = LOG_INFO;
+ const char *syslog_prefix = "INFO";
+#endif
if (linemax == 0) {
#ifdef HAVE_SYSCONF
@@ -65,13 +114,25 @@ void __wmessage(const char *func, const char *file, int
line, int type, const ch
switch (type) {
case WMESSAGE_TYPE_FATAL:
- strncat(buf, _("fatal error: "), linemax - 1 -
strlen(buf));
+ strncat(buf, _("fatal: "), linemax - 1 - strlen(buf));
+#ifdef HAVE_SYSLOG
+ syslog_priority = LOG_CRIT;
+ syslog_prefix = "FATAL";
+#endif
break;
case WMESSAGE_TYPE_ERROR:
strncat(buf, _("error: "), linemax - 1 - strlen(buf));
+#ifdef HAVE_SYSLOG
+ syslog_priority = LOG_ERR;
+ syslog_prefix = "ERROR";
+#endif
break;
case WMESSAGE_TYPE_WARNING:
- strncat(buf, _("warning: "), linemax - 1 - strlen(buf));
+ strncat(buf, _("warn: "), linemax - 1 - strlen(buf));
+#ifdef HAVE_SYSLOG
+ syslog_priority = LOG_WARNING;
+ syslog_prefix = "WARNING";
+#endif
break;
case WMESSAGE_TYPE_MESSAGE:
/* FALLTHROUGH */
@@ -86,6 +147,9 @@ void __wmessage(const char *func, const char *file, int
line, int type, const ch
va_end(args);
fputs(buf, stderr);
+#ifdef HAVE_SYSLOG
+ syslog_message(syslog_priority, _WINGS_progname ? _WINGS_progname :
"WINGs", buf);
+#endif
if (truncated)
fputs("*** message truncated ***", stderr);
diff --git a/configure.ac b/configure.ac
index aa6b5b54..d642489b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -293,6 +293,11 @@ dnl =================
AC_CHECK_HEADERS(sys/inotify.h, AC_DEFINE(HAVE_INOTIFY, 1, Check for inotify))
+dnl Check for syslog
+dnl =================
+AC_CHECK_HEADERS(syslog.h, AC_DEFINE(HAVE_SYSLOG, 1, Check for syslog))
+
+
dnl Checks for header files.
dnl =======================
AC_HEADER_SYS_WAIT
diff --git a/src/startup.c b/src/startup.c
index 6ede6f58..34e3635c 100644
--- a/src/startup.c
+++ b/src/startup.c
@@ -160,6 +160,11 @@ static RETSIGTYPE handleExitSig(int sig)
}
sigprocmask(SIG_UNBLOCK, &sigs, NULL);
+
+#ifdef HAVE_SYSLOG
+ syslog_shutdown();
+#endif
+
DispatchEvent(NULL); /* Dispatch events imediately. */
}
-----------------------------------------------------------------------
Summary of changes:
WINGs/error.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
repo.or.cz automatic notification. Contact project admin [email protected]
if you want to unsubscribe, or site admin [email protected] if you receive
no reply.
--
wmaker-crm.git ("The Window Maker window manager")
--
To unsubscribe, send mail to [email protected].