Our preferred shared logging system is exported via the libqb library. As a result, the corosync project no longer needs to export logsys.so and the code can be directly included in the binary. The header file can also be removed. Signed-off-by: Steven Dake <sdake@xxxxxxxxxx> --- TODO | 5 +- corosync.spec.in | 3 - cts/agents/syncv2.c | 2 +- exec/Makefile.am | 29 +---- exec/apidef.c | 2 +- exec/coroparse.c | 2 +- exec/evil.c | 4 +- exec/ipc_glue.c | 2 +- exec/logsys.c | 2 +- exec/main.c | 2 +- exec/mainconfig.c | 2 +- exec/mainconfig.h | 2 +- exec/quorum.c | 2 +- exec/service.c | 2 +- exec/sync.c | 2 +- exec/syncv2.c | 2 +- exec/totemconfig.c | 4 +- exec/totemiba.c | 2 +- exec/totemnet.c | 2 +- exec/totempg.c | 2 +- exec/totemrrp.c | 2 +- exec/totemsrp.c | 2 +- exec/totemudp.c | 2 +- exec/totemudpu.c | 2 +- exec/util.c | 2 +- exec/vsf_quorum.c | 2 +- exec/vsf_ykd.c | 2 +- include/Makefile.am | 4 +- include/corosync/engine/logsys.h | 218 -------------------------------------- include/corosync/logsys.h | 218 ++++++++++++++++++++++++++++++++++++++ services/cfg.c | 2 +- services/cmap.c | 2 +- services/cpg.c | 2 +- services/evs.c | 2 +- services/mon.c | 2 +- services/pload.c | 2 +- services/testquorum.c | 2 +- services/votequorum.c | 2 +- services/wd.c | 2 +- test/Makefile.am | 10 +-- test/logsys_s.c | 57 ---------- test/logsys_s1.c | 50 --------- test/logsys_s2.c | 52 --------- test/logsys_t1.c | 54 ---------- test/logsys_t2.c | 85 --------------- test/logsysrec.c | 66 ------------ 46 files changed, 263 insertions(+), 658 deletions(-) delete mode 100644 include/corosync/engine/logsys.h create mode 100644 include/corosync/logsys.h delete mode 100644 test/logsys_s.c delete mode 100644 test/logsys_s1.c delete mode 100644 test/logsys_s2.c delete mode 100644 test/logsys_t1.c delete mode 100644 test/logsys_t2.c delete mode 100644 test/logsysrec.c diff --git a/TODO b/TODO index 4e47213..6fdc5ec 100644 --- a/TODO +++ b/TODO @@ -11,9 +11,8 @@ -------------------------------------- 1. quorum debugging and rework 2. remove external plug-in api -3. remove logsys.h from external headers -4. allow a cluster name to autogenerate a mcastaddr -5. ring status change via corosync-notifyd +3. allow a cluster name to autogenerate a mcastaddr +4. ring status change via corosync-notifyd -------------------------------------- Current priority list for Needle 2.1 diff --git a/corosync.spec.in b/corosync.spec.in index a6f4d26..36956fd 100644 --- a/corosync.spec.in +++ b/corosync.spec.in @@ -244,7 +244,6 @@ This package contains corosync libraries. %{_libdir}/libcmap.so.* %{_libdir}/libevs.so.* %{_libdir}/libtotem_pg.so.* -%{_libdir}/liblogsys.so.* %{_libdir}/libicmap.so.* %{_libdir}/libquorum.so.* %{_libdir}/libvotequorum.so.* @@ -296,7 +295,6 @@ The Corosync Cluster Engine APIs. %dir %{_includedir}/corosync/engine %{_includedir}/corosync/engine/config.h %{_includedir}/corosync/engine/coroapi.h -%{_includedir}/corosync/engine/logsys.h %{_includedir}/corosync/engine/icmap.h %{_includedir}/corosync/engine/quorum.h %{_libdir}/libcfg.so @@ -304,7 +302,6 @@ The Corosync Cluster Engine APIs. %{_libdir}/libcmap.so %{_libdir}/libevs.so %{_libdir}/libtotem_pg.so -%{_libdir}/liblogsys.so %{_libdir}/libquorum.so %{_libdir}/libvotequorum.so %{_libdir}/libpload.so diff --git a/cts/agents/syncv2.c b/cts/agents/syncv2.c index 0b46558..d5d6eba 100644 --- a/cts/agents/syncv2.c +++ b/cts/agents/syncv2.c @@ -59,7 +59,7 @@ #include <corosync/mar_gen.h> #include <corosync/engine/coroapi.h> #include <corosync/list.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> LOGSYS_DECLARE_SUBSYS ("TST2"); diff --git a/exec/Makefile.am b/exec/Makefile.am index 7c63f9c..c738570 100644 --- a/exec/Makefile.am +++ b/exec/Makefile.am @@ -42,24 +42,22 @@ if BUILD_RDMA TOTEM_SRC += totemiba.c endif -LOGSYS_SRC = logsys.c ICMAP_SRC = icmap.c LCRSO_SRC = vsf_ykd.c coroparse.c vsf_quorum.c LCRSO_OBJS = $(LCRSO_SRC:%.c=%.o) LCRSO = $(LCRSO_SRC:%.c=%.lcrso) -lib_LIBRARIES = libtotem_pg.a liblogsys.a libicmap.a +lib_LIBRARIES = libtotem_pg.a libicmap.a sbin_PROGRAMS = corosync libtotem_pg_a_SOURCES = $(TOTEM_SRC) -liblogsys_a_SOURCES = $(LOGSYS_SRC) libicmap_a_SOURCES = $(ICMAP_SRC) corosync_SOURCES = main.c ipc_glue.c util.c sync.c apidef.c service.c \ timer.c totemconfig.c mainconfig.c quorum.c schedwrk.c \ - ../lcr/lcr_ifact.c evil.c syncv2.c -corosync_LDADD = -ltotem_pg -llogsys -licmap $(LIBQB_LIBS) $(statgrab_LIBS) -corosync_DEPENDENCIES = libtotem_pg.so.$(SONAME) liblogsys.so.$(SONAME) libicmap.so.$(SONAME) + ../lcr/lcr_ifact.c evil.c syncv2.c logsys.c +corosync_LDADD = -ltotem_pg -licmap $(LIBQB_LIBS) $(statgrab_LIBS) +corosync_DEPENDENCIES = libtotem_pg.so.$(SONAME) libicmap.so.$(SONAME) corosync_LDFLAGS = $(OS_DYFLAGS) -L./ TOTEM_OBJS = $(TOTEM_SRC:%.c=%.o) @@ -80,18 +78,13 @@ EXTRA_DIST = $(LCRSO_SRC) if BUILD_DARWIN %.lcrso: %.o - $(CC) $(LDFLAGS) $(CFLAGS) -L$(top_builddir)/exec -llogsys -licmap -bundle -bind_at_load -bundle_loader ./corosync $^ -o $@ + $(CC) $(LDFLAGS) $(CFLAGS) -L$(top_builddir)/exec -licmap -bundle -bind_at_load -bundle_loader ./corosync $^ -o $@ libtotem_pg.so.$(SONAME): $(TOTEM_OBJS) $(CC) $(LDFLAGS) $(DARWIN_OPTS) $(TOTEM_OBJS) -o $@ -lpthread ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so.$(SOMAJOR) -liblogsys.so.$(SONAME): $(LOGSYS_OBJS) - $(CC) $(LDFLAGS) $(DARWIN_OPTS) $(LOGSYS_OBJS) -o $@ -lpthread - ln -sf liblogsys.so.$(SONAME) liblogsys.so - ln -sf liblogsys.so.$(SONAME) liblogsys.so.$(SOMAJOR) - libicmap.so.$(SONAME): $(ICMAP_OBJS) $(CC) $(LDFLAGS) $(DARWIN_OPTS) $(ICMAP_OBJS) -o $@ -lpthread ln -sf libicmap.so.$(SONAME) libicmap.so @@ -108,11 +101,6 @@ libtotem_pg.so.$(SONAME): $(TOTEM_OBJS) ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so.$(SOMAJOR) -liblogsys.so.$(SONAME): $(LOGSYS_OBJS) - $(LD) $(LDFLAGS) -G $(LOGSYS_OBJS) -o $@ -lpthread - ln -sf liblogsys.so.$(SONAME) liblogsys.so - ln -sf liblogsys.so.$(SONAME) liblogsys.so.$(SOMAJOR) - else %.lcrso: %.o @@ -125,13 +113,6 @@ libtotem_pg.so.$(SONAME): $(TOTEM_OBJS) ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so ln -sf libtotem_pg.so.$(SONAME) libtotem_pg.so.$(SOMAJOR) -liblogsys.so.$(SONAME): $(LOGSYS_OBJS) - $(CC) -shared -o $@ \ - -Wl,-soname=liblogsys.so.$(SOMAJOR) \ - $(LDFLAGS) $^ -lpthread - ln -sf liblogsys.so.$(SONAME) liblogsys.so - ln -sf liblogsys.so.$(SONAME) liblogsys.so.$(SOMAJOR) - libicmap.so.$(SONAME): $(ICMAP_OBJS) $(CC) -shared -o $@ \ -Wl,-soname=libicmap.so.$(SOMAJOR) \ diff --git a/exec/apidef.c b/exec/apidef.c index 5d738c9..795b594 100644 --- a/exec/apidef.c +++ b/exec/apidef.c @@ -46,7 +46,7 @@ #include <corosync/totem/totempg.h> #include <corosync/totem/totemip.h> #include <corosync/totem/totem.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include "util.h" #include "timer.h" #include "sync.h" diff --git a/exec/coroparse.c b/exec/coroparse.c index e88f9cf..98e5189 100644 --- a/exec/coroparse.c +++ b/exec/coroparse.c @@ -58,7 +58,7 @@ #include <corosync/lcr/lcr_comp.h> #include <qb/qbutil.h> #define LOGSYS_UTILS_ONLY 1 -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include <corosync/engine/icmap.h> #include <corosync/engine/config.h> diff --git a/exec/evil.c b/exec/evil.c index 94db799..ba4bde9 100644 --- a/exec/evil.c +++ b/exec/evil.c @@ -70,9 +70,9 @@ #include <corosync/corodefs.h> #include <corosync/list.h> #include <corosync/lcr/lcr_ifact.h> -#include <corosync/engine/config.h> +#include <corosync/config.h> #include <corosync/engine/coroapi.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include <qb/qbipcs.h> #include "sync.h" #include "evil.h" diff --git a/exec/ipc_glue.c b/exec/ipc_glue.c index 4df5b6d..9a5d06d 100644 --- a/exec/ipc_glue.c +++ b/exec/ipc_glue.c @@ -51,7 +51,7 @@ #include <corosync/corotypes.h> #include <corosync/corodefs.h> #include <corosync/totem/totempg.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include <corosync/engine/icmap.h> #include "mainconfig.h" diff --git a/exec/logsys.c b/exec/logsys.c index 0a44454..12e70fc 100644 --- a/exec/logsys.c +++ b/exec/logsys.c @@ -48,7 +48,7 @@ #include <qb/qblog.h> #include <corosync/list.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> /* * syslog prioritynames, facility names to value mapping diff --git a/exec/main.c b/exec/main.c index 019f659..bb4d13f 100644 --- a/exec/main.c +++ b/exec/main.c @@ -108,7 +108,7 @@ #include <corosync/lcr/lcr_ifact.h> #include <corosync/totem/totempg.h> #include <corosync/engine/config.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include <corosync/engine/icmap.h> #include "quorum.h" diff --git a/exec/mainconfig.c b/exec/mainconfig.c index 1c0d4a9..282f02c 100644 --- a/exec/mainconfig.c +++ b/exec/mainconfig.c @@ -49,7 +49,7 @@ #include <corosync/corotypes.h> #include <corosync/list.h> #include <corosync/totem/totem.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include <corosync/engine/icmap.h> #include "util.h" diff --git a/exec/mainconfig.h b/exec/mainconfig.h index 5f7a2c2..3de7a7e 100644 --- a/exec/mainconfig.h +++ b/exec/mainconfig.h @@ -35,7 +35,7 @@ #ifndef MAINCONFIG_H_DEFINED #define MAINCONFIG_H_DEFINED -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include <corosync/list.h> #include <corosync/engine/coroapi.h> diff --git a/exec/quorum.c b/exec/quorum.c index b81708c..1e76827 100644 --- a/exec/quorum.c +++ b/exec/quorum.c @@ -55,7 +55,7 @@ #include <corosync/totem/totempg.h> #include <corosync/totem/totem.h> #include <corosync/lcr/lcr_ifact.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include "quorum.h" #include "main.h" diff --git a/exec/service.c b/exec/service.c index 53a7798..a7be311 100644 --- a/exec/service.c +++ b/exec/service.c @@ -45,7 +45,7 @@ #include <corosync/corotypes.h> #include "mainconfig.h" #include "util.h" -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include <corosync/engine/icmap.h> #include "timer.h" diff --git a/exec/sync.c b/exec/sync.c index ce99129..0cf01b3 100644 --- a/exec/sync.c +++ b/exec/sync.c @@ -55,7 +55,7 @@ #include <corosync/totem/totempg.h> #include <corosync/totem/totem.h> #include <corosync/lcr/lcr_ifact.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include <qb/qbipc_common.h> #include "quorum.h" #include "sync.h" diff --git a/exec/syncv2.c b/exec/syncv2.c index 8a96615..a278be8 100644 --- a/exec/syncv2.c +++ b/exec/syncv2.c @@ -54,7 +54,7 @@ #include <corosync/totem/totempg.h> #include <corosync/totem/totem.h> #include <corosync/lcr/lcr_ifact.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include <qb/qbipc_common.h> #include "schedwrk.h" #include "quorum.h" diff --git a/exec/totemconfig.c b/exec/totemconfig.c index b0292b1..e5893b9 100644 --- a/exec/totemconfig.c +++ b/exec/totemconfig.c @@ -53,8 +53,8 @@ #include <corosync/list.h> #include <qb/qbdefs.h> #include <corosync/totem/totem.h> -#include <corosync/engine/config.h> -#include <corosync/engine/logsys.h> +#include <corosync/config.h> +#include <corosync/logsys.h> #include <corosync/engine/icmap.h> #ifdef HAVE_LIBNSS diff --git a/exec/totemiba.c b/exec/totemiba.c index ffcfceb..b0b178d 100644 --- a/exec/totemiba.c +++ b/exec/totemiba.c @@ -74,7 +74,7 @@ #include <qb/qbdefs.h> #include <qb/qbloop.h> #define LOGSYS_UTILS_ONLY 1 -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include "totemiba.h" #include "wthread.h" diff --git a/exec/totemnet.c b/exec/totemnet.c index 9b211f7..0343b31 100644 --- a/exec/totemnet.c +++ b/exec/totemnet.c @@ -46,7 +46,7 @@ #include <qb/qbloop.h> #define LOGSYS_UTILS_ONLY 1 -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> struct transport { const char *name; diff --git a/exec/totempg.c b/exec/totempg.c index 3f07c95..acc0c2f 100644 --- a/exec/totempg.c +++ b/exec/totempg.c @@ -103,7 +103,7 @@ #include <qb/qbipcs.h> #include <corosync/totem/totempg.h> #define LOGSYS_UTILS_ONLY 1 -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include "totemmrp.h" #include "totemsrp.h" diff --git a/exec/totemrrp.c b/exec/totemrrp.c index 452a1e6..89b9fd6 100644 --- a/exec/totemrrp.c +++ b/exec/totemrrp.c @@ -64,7 +64,7 @@ #include <qb/qbdefs.h> #include <qb/qbloop.h> #define LOGSYS_UTILS_ONLY 1 -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include "totemnet.h" #include "totemrrp.h" diff --git a/exec/totemsrp.c b/exec/totemsrp.c index 5a78962..9d3d32d 100644 --- a/exec/totemsrp.c +++ b/exec/totemsrp.c @@ -83,7 +83,7 @@ #include <corosync/list.h> #define LOGSYS_UTILS_ONLY 1 -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include "totemsrp.h" #include "totemrrp.h" diff --git a/exec/totemudp.c b/exec/totemudp.c index b3fcb1b..200b9b8 100644 --- a/exec/totemudp.c +++ b/exec/totemudp.c @@ -64,7 +64,7 @@ #include <qb/qbdefs.h> #include <qb/qbloop.h> #define LOGSYS_UTILS_ONLY 1 -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include "totemudp.h" #include "crypto.h" diff --git a/exec/totemudpu.c b/exec/totemudpu.c index f9e07d0..6c6eae1 100644 --- a/exec/totemudpu.c +++ b/exec/totemudpu.c @@ -64,7 +64,7 @@ #include <corosync/list.h> #include <corosync/swab.h> #define LOGSYS_UTILS_ONLY 1 -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include "totemudpu.h" #include "crypto.h" diff --git a/exec/util.c b/exec/util.c index 848a080..6fde9f0 100644 --- a/exec/util.c +++ b/exec/util.c @@ -46,7 +46,7 @@ #include <corosync/corotypes.h> #include <corosync/corodefs.h> #include <corosync/list.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include "util.h" LOGSYS_DECLARE_SUBSYS ("MAIN"); diff --git a/exec/vsf_quorum.c b/exec/vsf_quorum.c index 15db962..79bea03 100644 --- a/exec/vsf_quorum.c +++ b/exec/vsf_quorum.c @@ -65,7 +65,7 @@ #include <corosync/lcr/lcr_ifact.h> #include <corosync/mar_gen.h> #include <corosync/engine/coroapi.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include <corosync/engine/quorum.h> #include <corosync/engine/icmap.h> diff --git a/exec/vsf_ykd.c b/exec/vsf_ykd.c index 3e3dfa8..f8cdd04 100644 --- a/exec/vsf_ykd.c +++ b/exec/vsf_ykd.c @@ -56,7 +56,7 @@ #include <sched.h> #include <time.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include <corosync/corotypes.h> #include <qb/qbipc_common.h> #include <corosync/mar_gen.h> diff --git a/include/Makefile.am b/include/Makefile.am index 5c0aab7..a36cfc0 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -36,11 +36,11 @@ CS_H = hdb.h cs_config.h cpg.h cfg.h evs.h mar_gen.h swab.h \ list.h corotypes.h quorum.h votequorum.h sam.h cmap.h CS_INTERNAL_H = ipc_cfg.h ipc_cpg.h ipc_evs.h ipc_pload.h ipc_quorum.h \ - jhash.h pload.h quorum.h sq.h ipc_votequorum.h ipc_cmap.h + jhash.h pload.h quorum.h sq.h ipc_votequorum.h ipc_cmap.h logsys.h LCR_H = lcr_ckpt.h lcr_comp.h lcr_ifact.h -ENGINE_H = config.h coroapi.h logsys.h quorum.h icmap.h +ENGINE_H = config.h coroapi.h quorum.h icmap.h TOTEM_H = totem.h totemip.h totempg.h diff --git a/include/corosync/engine/logsys.h b/include/corosync/engine/logsys.h deleted file mode 100644 index 247881e..0000000 --- a/include/corosync/engine/logsys.h +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2002-2004 MontaVista Software, Inc. - * Copyright (c) 2006-2009 Red Hat, Inc. - * - * Author: Steven Dake (sdake@xxxxxxxxxx) - * Author: Lon Hohberger (lhh@xxxxxxxxxx) - * Author: Fabio M. Di Nitto (fdinitto@xxxxxxxxxx) - * - * All rights reserved. - * - * This software licensed under BSD license, the text of which follows: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - Neither the name of the MontaVista Software, Inc. nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef LOGSYS_H_DEFINED -#define LOGSYS_H_DEFINED - -#include <stdarg.h> -#include <stdlib.h> -#include <syslog.h> -#include <pthread.h> -#include <limits.h> - -#include <qb/qblog.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * All of the LOGSYS_MODE's can be ORed together for combined behavior - * - * FORK and THREADED are ignored for SUBSYSTEMS - */ -#define LOGSYS_MODE_OUTPUT_FILE (1<<0) -#define LOGSYS_MODE_OUTPUT_STDERR (1<<1) -#define LOGSYS_MODE_OUTPUT_SYSLOG (1<<2) -#define LOGSYS_MODE_FORK (1<<3) -#define LOGSYS_MODE_THREADED (1<<4) - -/* - * Log priorities, compliant with syslog and SA Forum Log spec. - */ -#define LOGSYS_LEVEL_EMERG LOG_EMERG -#define LOGSYS_LEVEL_ALERT LOG_ALERT -#define LOGSYS_LEVEL_CRIT LOG_CRIT -#define LOGSYS_LEVEL_ERROR LOG_ERR -#define LOGSYS_LEVEL_WARNING LOG_WARNING -#define LOGSYS_LEVEL_NOTICE LOG_NOTICE -#define LOGSYS_LEVEL_INFO LOG_INFO -#define LOGSYS_LEVEL_DEBUG LOG_DEBUG - -/* - * logsys_logger bits - * - * SUBSYS_COUNT defines the maximum number of subsystems - * SUBSYS_NAMELEN defines the maximum len of a subsystem name - */ -#define LOGSYS_MAX_SUBSYS_COUNT 64 -#define LOGSYS_MAX_SUBSYS_NAMELEN 64 -#define LOGSYS_MAX_PERROR_MSG_LEN 128 - -#ifndef LOGSYS_UTILS_ONLY - -/* - * configuration bits that can only be done for the whole system - */ -extern int logsys_format_set ( - const char *format); - -extern char *logsys_format_get (void); - -/* - * per system/subsystem settings. - * - * NOTE: once a subsystem is created and configured, changing - * the default does NOT affect the subsystems. - * - * Pass a NULL subsystem to change them all - */ -extern int logsys_config_syslog_facility_set ( - const char *subsys, - unsigned int facility); - -extern int logsys_config_syslog_priority_set ( - const char *subsys, - unsigned int priority); - -extern int logsys_config_mode_set ( - const char *subsys, - unsigned int mode); - -extern unsigned int logsys_config_mode_get ( - const char *subsys); - -void logsys_config_apply(void); - -/* - * to close a logfile, just invoke this function with a NULL - * file or if you want to change logfile, the old one will - * be closed for you. - */ -extern int logsys_config_file_set ( - const char *subsys, - const char **error_string, - const char *file); - -extern int logsys_config_logfile_priority_set ( - const char *subsys, - unsigned int priority); - -/* - * enabling debug, disable message priority filtering. - * everything is sent everywhere. priority values - * for file and syslog are not overwritten. - */ -extern int logsys_config_debug_set ( - const char *subsys, - unsigned int value); - -/* - * External API - helpers - * - * convert facility/priority to/from name/values - */ -extern int logsys_priority_id_get ( - const char *name); - -extern const char *logsys_priority_name_get ( - unsigned int priority); - -extern int _logsys_system_setup( - const char *mainsystem, - unsigned int mode, - int syslog_facility, - int syslog_priority); - -extern void logsys_system_fini (void); - -extern int _logsys_config_subsys_get ( - const char *subsys); - -extern int _logsys_subsys_create (const char *subsys, const char *filename); - -static int logsys_subsys_id __attribute__((unused)) = LOGSYS_MAX_SUBSYS_COUNT; - -#define LOGSYS_DECLARE_SYSTEM(name,mode,syslog_facility,syslog_priority)\ -__attribute__ ((constructor)) \ -static void logsys_system_init (void) \ -{ \ - if (_logsys_system_setup (name,mode,syslog_facility,syslog_priority) < 0) { \ - fprintf (stderr, \ - "Unable to setup logging system: %s.\n", name); \ - exit (-1); \ - } \ -} - -#define LOGSYS_DECLARE_SUBSYS(subsys) \ -__attribute__ ((constructor)) \ -static void logsys_subsys_init (void) \ -{ \ - assert(__start___verbose != __stop___verbose); \ - logsys_subsys_id = \ - _logsys_subsys_create ((subsys), __FILE__); \ - if (logsys_subsys_id == -1) { \ - fprintf (stderr, \ - "Unable to create logging subsystem: %s.\n", subsys); \ - exit (-1); \ - } \ -} - -#define LOGSYS_PERROR(err_num, level, fmt, args...) do { \ - char _error_str[LOGSYS_MAX_PERROR_MSG_LEN]; \ - const char *_error_ptr = qb_strerror_r(err_num, _error_str, sizeof(_error_str)); \ - qb_log(level, fmt ": %s (%d)\n", ##args, _error_ptr, err_num); \ - } while(0) - -#define log_printf(level, format, args...) qb_log(level, format, ##args) -#define ENTER qb_enter -#define LEAVE qb_leave -#define TRACE1(format, args...) qb_log(LOG_TRACE, "TRACE1:" #format, ##args) -#define TRACE2(format, args...) qb_log(LOG_TRACE, "TRACE2:" #format, ##args) -#define TRACE3(format, args...) qb_log(LOG_TRACE, "TRACE3:" #format, ##args) -#define TRACE4(format, args...) qb_log(LOG_TRACE, "TRACE4:" #format, ##args) -#define TRACE5(format, args...) qb_log(LOG_TRACE, "TRACE5:" #format, ##args) -#define TRACE6(format, args...) qb_log(LOG_TRACE, "TRACE6:" #format, ##args) -#define TRACE7(format, args...) qb_log(LOG_TRACE, "TRACE7:" #format, ##args) -#define TRACE8(format, args...) qb_log(LOG_TRACE, "TRACE8:" #format, ##args) - -#endif /* LOGSYS_UTILS_ONLY */ - -#ifdef __cplusplus -} -#endif - -#endif /* LOGSYS_H_DEFINED */ diff --git a/include/corosync/logsys.h b/include/corosync/logsys.h new file mode 100644 index 0000000..247881e --- /dev/null +++ b/include/corosync/logsys.h @@ -0,0 +1,218 @@ +/* + * Copyright (c) 2002-2004 MontaVista Software, Inc. + * Copyright (c) 2006-2009 Red Hat, Inc. + * + * Author: Steven Dake (sdake@xxxxxxxxxx) + * Author: Lon Hohberger (lhh@xxxxxxxxxx) + * Author: Fabio M. Di Nitto (fdinitto@xxxxxxxxxx) + * + * All rights reserved. + * + * This software licensed under BSD license, the text of which follows: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the MontaVista Software, Inc. nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef LOGSYS_H_DEFINED +#define LOGSYS_H_DEFINED + +#include <stdarg.h> +#include <stdlib.h> +#include <syslog.h> +#include <pthread.h> +#include <limits.h> + +#include <qb/qblog.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * All of the LOGSYS_MODE's can be ORed together for combined behavior + * + * FORK and THREADED are ignored for SUBSYSTEMS + */ +#define LOGSYS_MODE_OUTPUT_FILE (1<<0) +#define LOGSYS_MODE_OUTPUT_STDERR (1<<1) +#define LOGSYS_MODE_OUTPUT_SYSLOG (1<<2) +#define LOGSYS_MODE_FORK (1<<3) +#define LOGSYS_MODE_THREADED (1<<4) + +/* + * Log priorities, compliant with syslog and SA Forum Log spec. + */ +#define LOGSYS_LEVEL_EMERG LOG_EMERG +#define LOGSYS_LEVEL_ALERT LOG_ALERT +#define LOGSYS_LEVEL_CRIT LOG_CRIT +#define LOGSYS_LEVEL_ERROR LOG_ERR +#define LOGSYS_LEVEL_WARNING LOG_WARNING +#define LOGSYS_LEVEL_NOTICE LOG_NOTICE +#define LOGSYS_LEVEL_INFO LOG_INFO +#define LOGSYS_LEVEL_DEBUG LOG_DEBUG + +/* + * logsys_logger bits + * + * SUBSYS_COUNT defines the maximum number of subsystems + * SUBSYS_NAMELEN defines the maximum len of a subsystem name + */ +#define LOGSYS_MAX_SUBSYS_COUNT 64 +#define LOGSYS_MAX_SUBSYS_NAMELEN 64 +#define LOGSYS_MAX_PERROR_MSG_LEN 128 + +#ifndef LOGSYS_UTILS_ONLY + +/* + * configuration bits that can only be done for the whole system + */ +extern int logsys_format_set ( + const char *format); + +extern char *logsys_format_get (void); + +/* + * per system/subsystem settings. + * + * NOTE: once a subsystem is created and configured, changing + * the default does NOT affect the subsystems. + * + * Pass a NULL subsystem to change them all + */ +extern int logsys_config_syslog_facility_set ( + const char *subsys, + unsigned int facility); + +extern int logsys_config_syslog_priority_set ( + const char *subsys, + unsigned int priority); + +extern int logsys_config_mode_set ( + const char *subsys, + unsigned int mode); + +extern unsigned int logsys_config_mode_get ( + const char *subsys); + +void logsys_config_apply(void); + +/* + * to close a logfile, just invoke this function with a NULL + * file or if you want to change logfile, the old one will + * be closed for you. + */ +extern int logsys_config_file_set ( + const char *subsys, + const char **error_string, + const char *file); + +extern int logsys_config_logfile_priority_set ( + const char *subsys, + unsigned int priority); + +/* + * enabling debug, disable message priority filtering. + * everything is sent everywhere. priority values + * for file and syslog are not overwritten. + */ +extern int logsys_config_debug_set ( + const char *subsys, + unsigned int value); + +/* + * External API - helpers + * + * convert facility/priority to/from name/values + */ +extern int logsys_priority_id_get ( + const char *name); + +extern const char *logsys_priority_name_get ( + unsigned int priority); + +extern int _logsys_system_setup( + const char *mainsystem, + unsigned int mode, + int syslog_facility, + int syslog_priority); + +extern void logsys_system_fini (void); + +extern int _logsys_config_subsys_get ( + const char *subsys); + +extern int _logsys_subsys_create (const char *subsys, const char *filename); + +static int logsys_subsys_id __attribute__((unused)) = LOGSYS_MAX_SUBSYS_COUNT; + +#define LOGSYS_DECLARE_SYSTEM(name,mode,syslog_facility,syslog_priority)\ +__attribute__ ((constructor)) \ +static void logsys_system_init (void) \ +{ \ + if (_logsys_system_setup (name,mode,syslog_facility,syslog_priority) < 0) { \ + fprintf (stderr, \ + "Unable to setup logging system: %s.\n", name); \ + exit (-1); \ + } \ +} + +#define LOGSYS_DECLARE_SUBSYS(subsys) \ +__attribute__ ((constructor)) \ +static void logsys_subsys_init (void) \ +{ \ + assert(__start___verbose != __stop___verbose); \ + logsys_subsys_id = \ + _logsys_subsys_create ((subsys), __FILE__); \ + if (logsys_subsys_id == -1) { \ + fprintf (stderr, \ + "Unable to create logging subsystem: %s.\n", subsys); \ + exit (-1); \ + } \ +} + +#define LOGSYS_PERROR(err_num, level, fmt, args...) do { \ + char _error_str[LOGSYS_MAX_PERROR_MSG_LEN]; \ + const char *_error_ptr = qb_strerror_r(err_num, _error_str, sizeof(_error_str)); \ + qb_log(level, fmt ": %s (%d)\n", ##args, _error_ptr, err_num); \ + } while(0) + +#define log_printf(level, format, args...) qb_log(level, format, ##args) +#define ENTER qb_enter +#define LEAVE qb_leave +#define TRACE1(format, args...) qb_log(LOG_TRACE, "TRACE1:" #format, ##args) +#define TRACE2(format, args...) qb_log(LOG_TRACE, "TRACE2:" #format, ##args) +#define TRACE3(format, args...) qb_log(LOG_TRACE, "TRACE3:" #format, ##args) +#define TRACE4(format, args...) qb_log(LOG_TRACE, "TRACE4:" #format, ##args) +#define TRACE5(format, args...) qb_log(LOG_TRACE, "TRACE5:" #format, ##args) +#define TRACE6(format, args...) qb_log(LOG_TRACE, "TRACE6:" #format, ##args) +#define TRACE7(format, args...) qb_log(LOG_TRACE, "TRACE7:" #format, ##args) +#define TRACE8(format, args...) qb_log(LOG_TRACE, "TRACE8:" #format, ##args) + +#endif /* LOGSYS_UTILS_ONLY */ + +#ifdef __cplusplus +} +#endif + +#endif /* LOGSYS_H_DEFINED */ diff --git a/services/cfg.c b/services/cfg.c index ae42baf..b00ae93 100644 --- a/services/cfg.c +++ b/services/cfg.c @@ -59,7 +59,7 @@ #include <corosync/totem/totem.h> #include <corosync/ipc_cfg.h> #include <corosync/lcr/lcr_comp.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include <corosync/engine/coroapi.h> #include <corosync/engine/icmap.h> #include <corosync/corodefs.h> diff --git a/services/cmap.c b/services/cmap.c index 92f0574..076d8db 100644 --- a/services/cmap.c +++ b/services/cmap.c @@ -52,7 +52,7 @@ #include <corosync/mar_gen.h> #include <corosync/ipc_cmap.h> #include <corosync/lcr/lcr_comp.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include <corosync/engine/coroapi.h> #include <corosync/engine/icmap.h> diff --git a/services/cpg.c b/services/cpg.c index 56b5ca1..008a3ea 100644 --- a/services/cpg.c +++ b/services/cpg.c @@ -63,7 +63,7 @@ #include <corosync/list.h> #include <corosync/jhash.h> #include <corosync/lcr/lcr_comp.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include <corosync/engine/coroapi.h> #include <corosync/cpg.h> diff --git a/services/evs.c b/services/evs.c index 43c65d6..e8d5879 100644 --- a/services/evs.c +++ b/services/evs.c @@ -58,7 +58,7 @@ #include <corosync/mar_gen.h> #include <corosync/lcr/lcr_comp.h> #include <corosync/engine/coroapi.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include <corosync/list.h> #include <corosync/evs.h> diff --git a/services/mon.c b/services/mon.c index 15d32b5..a0bc705 100644 --- a/services/mon.c +++ b/services/mon.c @@ -44,7 +44,7 @@ #include <corosync/lcr/lcr_comp.h> #include <corosync/engine/coroapi.h> #include <corosync/list.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include <corosync/engine/icmap.h> #include "../exec/fsm.h" diff --git a/services/pload.c b/services/pload.c index e2f6e77..85a485f 100644 --- a/services/pload.c +++ b/services/pload.c @@ -64,7 +64,7 @@ #include <corosync/engine/coroapi.h> #include <corosync/ipc_pload.h> #include <corosync/list.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> LOGSYS_DECLARE_SUBSYS ("PLOAD"); diff --git a/services/testquorum.c b/services/testquorum.c index 806040a..3cdf9cd 100644 --- a/services/testquorum.c +++ b/services/testquorum.c @@ -57,7 +57,7 @@ #include <corosync/corotypes.h> #include <qb/qbipc_common.h> #include <corosync/corodefs.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include <corosync/engine/icmap.h> #include <corosync/mar_gen.h> diff --git a/services/votequorum.c b/services/votequorum.c index cc13a1b..d9930fb 100644 --- a/services/votequorum.c +++ b/services/votequorum.c @@ -64,7 +64,7 @@ #include <corosync/cfg.h> #include <corosync/list.h> #include <corosync/lcr/lcr_comp.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include <corosync/mar_gen.h> #include <corosync/engine/coroapi.h> #include <corosync/engine/quorum.h> diff --git a/services/wd.c b/services/wd.c index 58c5939..72544ae 100644 --- a/services/wd.c +++ b/services/wd.c @@ -46,7 +46,7 @@ #include <corosync/lcr/lcr_comp.h> #include <corosync/engine/coroapi.h> #include <corosync/list.h> -#include <corosync/engine/logsys.h> +#include <corosync/logsys.h> #include <corosync/engine/icmap.h> #include "../exec/fsm.h" diff --git a/test/Makefile.am b/test/Makefile.am index 7c9453b..178e711 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -36,8 +36,7 @@ INCLUDES = -I$(top_builddir)/include/corosync -I$(top_srcdir)/include noinst_PROGRAMS = testevs evsbench evsverify cpgverify testcpg testcpg2 cpgbench \ testquorum testvotequorum1 testvotequorum2 \ stress_cpgfdget stress_cpgcontext cpgbound testsam \ - testcpgzc cpgbenchzc testzcgc stress_cpgzc \ - logsys_s logsys_t1 logsys_t2 + testcpgzc cpgbenchzc testzcgc stress_cpgzc testevs_LDADD = -levs $(LIBQB_LIBS) testevs_LDFLAGS = -L../lib @@ -73,13 +72,6 @@ cpgbench_LDADD = -lcpg $(LIBQB_LIBS) cpgbench_LDFLAGS = -L../lib cpgbenchzc_LDADD = -lcpg $(LIBQB_LIBS) cpgbenchzc_LDFLAGS = -L../lib -logsys_s_SOURCES = logsys_s.c logsys_s1.c logsys_s2.c -logsys_s_LDADD = -llogsys $(LIBQB_LIBS) -logsys_s_LDFLAGS = -L../exec -logsys_t1_LDADD = -llogsys $(LIBQB_LIBS) -logsys_t1_LDFLAGS = -L../exec -logsys_t2_LDADD = -llogsys $(LIBQB_LIBS) -logsys_t2_LDFLAGS = -L../exec testsam_LDADD = -lsam -lcmap -lquorum $(LIBQB_LIBS) testsam_LDFLAGS = -L../lib diff --git a/test/logsys_s.c b/test/logsys_s.c deleted file mode 100644 index 7eabacd..0000000 --- a/test/logsys_s.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2007 Red Hat, Inc. - * - * All rights reserved. - * - * Author: Steven Dake (sdake@xxxxxxxxxx) - * - * This software licensed under BSD license, the text of which follows: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - Neither the name of the MontaVista Software, Inc. nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <config.h> - -#include <stdio.h> -#include <syslog.h> -#include <assert.h> - -#include <corosync/engine/logsys.h> - -LOGSYS_DECLARE_SYSTEM ("logsystestsubsystems", - LOGSYS_MODE_OUTPUT_STDERR | LOGSYS_MODE_OUTPUT_SYSLOG, - LOG_DAEMON, - LOGSYS_LEVEL_INFO); -LOGSYS_DECLARE_SUBSYS ("MAIN"); - -extern void logsys_s1_print (void); -extern void logsys_s2_print (void); - -int main (void) { - qb_log_thread_start(); - logsys_s1_print(); - logsys_s2_print(); - return (0); -} diff --git a/test/logsys_s1.c b/test/logsys_s1.c deleted file mode 100644 index fb689dd..0000000 --- a/test/logsys_s1.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2007 Red Hat, Inc. - * - * All rights reserved. - * - * Author: Steven Dake (sdake@xxxxxxxxxx) - * - * This software licensed under BSD license, the text of which follows: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - Neither the name of the MontaVista Software, Inc. nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <config.h> - -#include <stdio.h> -#include <syslog.h> -#include <assert.h> - -#include <corosync/engine/logsys.h> - -void logsys_s1_print (void); - -LOGSYS_DECLARE_SUBSYS ("SYS1"); - -void logsys_s1_print (void) { - log_printf (LOGSYS_LEVEL_ALERT, "This is an alert log message\n"); - log_printf (LOGSYS_LEVEL_WARNING, "This is a warning log message\n"); -} diff --git a/test/logsys_s2.c b/test/logsys_s2.c deleted file mode 100644 index 8082886..0000000 --- a/test/logsys_s2.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2007 Red Hat, Inc. - * - * All rights reserved. - * - * Author: Steven Dake (sdake@xxxxxxxxxx) - * - * This software licensed under BSD license, the text of which follows: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - Neither the name of the MontaVista Software, Inc. nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <config.h> - -#include <stdio.h> -#include <syslog.h> -#include <assert.h> - -#include <corosync/engine/logsys.h> - -void logsys_s2_print (void); - -LOGSYS_DECLARE_SUBSYS ("SYS2"); - -void logsys_s2_print (void) { - logsys_config_logfile_priority_set("SYS2", LOGSYS_LEVEL_DEBUG); - log_printf (LOGSYS_LEVEL_ALERT, "This is an alert log message\n"); - log_printf (LOGSYS_LEVEL_WARNING, "This is a warning log message\n"); - log_printf (LOGSYS_LEVEL_DEBUG, "This is a debug log message\n"); -} diff --git a/test/logsys_t1.c b/test/logsys_t1.c deleted file mode 100644 index 06b2c59..0000000 --- a/test/logsys_t1.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2007 Red Hat, Inc. - * - * All rights reserved. - * - * Author: Steven Dake (sdake@xxxxxxxxxx) - * - * This software licensed under BSD license, the text of which follows: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - Neither the name of the MontaVista Software, Inc. nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <config.h> - -#include <stdio.h> -#include <syslog.h> -#include <assert.h> - -#include <corosync/engine/logsys.h> - -LOGSYS_DECLARE_SYSTEM ("logsystestNOsubsystems", - LOGSYS_MODE_OUTPUT_STDERR | LOGSYS_MODE_OUTPUT_SYSLOG, - LOG_DAEMON, - LOGSYS_LEVEL_DEBUG); -LOGSYS_DECLARE_SUBSYS("MAIN"); - -int main (void) { - log_printf (LOGSYS_LEVEL_ALERT, "This is an alert log message\n"); - log_printf (LOGSYS_LEVEL_WARNING, "This is a warning log message\n"); - log_printf (LOGSYS_LEVEL_DEBUG, "This is a debug log message\n"); - return (0); -} diff --git a/test/logsys_t2.c b/test/logsys_t2.c deleted file mode 100644 index fcee399..0000000 --- a/test/logsys_t2.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2007 Red Hat, Inc. - * - * All rights reserved. - * - * Author: Lon Hohberger (lhh@xxxxxxxxxx) - * - * This software licensed under BSD license, the text of which follows: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - Neither the name of the MontaVista Software, Inc. nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <config.h> - -#include <stdio.h> -#include <stdint.h> -#include <assert.h> - -#include <corosync/engine/logsys.h> - -LOGSYS_DECLARE_SYSTEM ("logtest_t2", - LOGSYS_MODE_OUTPUT_STDERR | LOGSYS_MODE_THREADED, - LOG_DAEMON, - LOGSYS_LEVEL_INFO); - -LOGSYS_DECLARE_SUBSYS("MAIN"); - -int -main(int argc, char **argv) -{ - /* - * fork could occur here and the file to output to could be set - */ - logsys_config_mode_set (NULL, LOGSYS_MODE_OUTPUT_STDERR | LOGSYS_MODE_THREADED); - - - log_printf(LOGSYS_LEVEL_NOTICE, "Hello, world!\n"); - log_printf(LOGSYS_LEVEL_DEBUG, "If you see this, the logger's busted\n"); - - logsys_config_logfile_priority_set (NULL, LOGSYS_LEVEL_ALERT); - logsys_config_apply(); - - log_printf(LOGSYS_LEVEL_DEBUG, "If you see this, the logger's busted\n"); - log_printf(LOGSYS_LEVEL_CRIT, "If you see this, the logger's busted\n"); - log_printf(LOGSYS_LEVEL_ALERT, "Alert 1\n"); - - logsys_config_logfile_priority_set (NULL, LOGSYS_LEVEL_NOTICE); - logsys_config_apply(); - - log_printf(LOGSYS_LEVEL_CRIT, "Crit 1\n"); - log_printf(LOGSYS_LEVEL_INFO, "If you see this, the logger's busted\n"); - - logsys_config_logfile_priority_set (NULL, LOGSYS_LEVEL_DEBUG); - logsys_config_apply(); - - log_printf(LOGSYS_LEVEL_DEBUG, "Debug 1\n"); - - logsys_config_mode_set (NULL, LOGSYS_MODE_OUTPUT_STDERR); - - log_printf(LOGSYS_LEVEL_DEBUG, "Debug 2\n"); - - return 0; -} diff --git a/test/logsysrec.c b/test/logsysrec.c deleted file mode 100644 index 2d05435..0000000 --- a/test/logsysrec.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2008 Red Hat, Inc. - * - * All rights reserved. - * - * Author: Steven Dake (sdake@xxxxxxxxxx) - * - * This software licensed under BSD license, the text of which follows: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * - Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - Neither the name of the MontaVista Software, Inc. nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <config.h> - -#include <stdio.h> -#include <stdint.h> -#include <corosync/engine/logsys.h> - -LOGSYS_DECLARE_SYSTEM ("logtest_rec", - LOGSYS_MODE_OUTPUT_STDERR | LOGSYS_MODE_THREADED, - LOG_DAEMON, - LOG_INFO); - -#define LOGREC_ID_CHECKPOINT_CREATE 2 -#define LOGREC_ARGS_CHECKPOINT_CREATE 2 - -int main(int argc, char **argv) -{ - int i; - - for (i = 0; i < 10000; i++) { - log_printf (LOGSYS_LEVEL_NOTICE, - "This is a test of %s(%d)\n", "stringparse", i); - - log_rec (LOGSYS_ENCODE_RECID(LOGSYS_LEVEL_NOTICE, - logsys_subsys_id, - LOGREC_ID_CHECKPOINT_CREATE), - "record1", 8, "record22", 9, "record333", 10, "record444", 11, LOGSYS_REC_END); - } - logsys_atexit (); - logsys_log_rec_store ("fdata"); - - return 0; -} -- 1.7.7.4 _______________________________________________ discuss mailing list discuss@xxxxxxxxxxxx http://lists.corosync.org/mailman/listinfo/discuss