summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <matthias@gamezock.de>2008-12-22 01:10:47 +0100
committerMatthias Schiffer <matthias@gamezock.de>2008-12-22 01:10:47 +0100
commit33ecd8fa230f1b50165121747c1e68a922c08909 (patch)
tree92bf6760be2385a713fd4ca6f88f7fd1c5f77d55 /src
parent389960211861736ef321df82f6abcb59f6302897 (diff)
downloadmad-33ecd8fa230f1b50165121747c1e68a922c08909.tar
mad-33ecd8fa230f1b50165121747c1e68a922c08909.zip
FileLogger als Modul ausgelagert
Diffstat (limited to 'src')
-rw-r--r--src/Common/Backends/ConsoleLogger.h49
-rw-r--r--src/Common/Backends/Makefile.am4
-rw-r--r--src/Common/Backends/Makefile.in447
-rw-r--r--src/Common/LogManager.cpp8
-rw-r--r--src/Common/LogManager.h18
-rw-r--r--src/Common/Makefile.am4
-rw-r--r--src/Common/Makefile.in8
-rw-r--r--src/Makefile.am6
-rw-r--r--src/Makefile.in8
-rw-r--r--src/mad-core.conf1
-rw-r--r--src/mad-core.cpp7
-rw-r--r--src/mad.cpp7
-rw-r--r--src/modules/FileLogger.cpp73
-rw-r--r--src/modules/FileLogger.h (renamed from src/Common/Backends/FileLogger.h)44
-rw-r--r--src/modules/Makefile.am15
-rw-r--r--src/modules/Makefile.in26
16 files changed, 177 insertions, 548 deletions
diff --git a/src/Common/Backends/ConsoleLogger.h b/src/Common/Backends/ConsoleLogger.h
deleted file mode 100644
index e1c8c43..0000000
--- a/src/Common/Backends/ConsoleLogger.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * ConsoleLogger.h
- *
- * Copyright (C) 2008 Johannes Thorn <dante@g4t3.de>
- *
- * 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 3 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, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef MAD_COMMON_BACKENDS_CONSOLELOGGER_H_
-#define MAD_COMMON_BACKENDS_CONSOLELOGGER_H_
-
-#include "../Logger.h"
-#include "../RemoteLogger.h"
-#include <iostream>
-#include <ctime>
-
-namespace Mad {
-namespace Common {
-namespace Backends {
-
-class ConsoleLogger : public Logger, public RemoteLogger {
- protected:
- virtual void logMessage(MessageCategory, MessageLevel, time_t, const std::string &message) {
- std::cerr << message << std::endl;
- }
- virtual void logMessage(MessageCategory, MessageLevel, time_t, const std::string &message, const std::string &messageSource) {
- std::cerr << message << " from "<< messageSource << std::endl;
- }
-
- public:
- ConsoleLogger() {}
-};
-
-}
-}
-}
-
-#endif /* MAD_COMMON_BACKENDS_CONSOLELOGGER_H_ */
diff --git a/src/Common/Backends/Makefile.am b/src/Common/Backends/Makefile.am
deleted file mode 100644
index ab20072..0000000
--- a/src/Common/Backends/Makefile.am
+++ /dev/null
@@ -1,4 +0,0 @@
-noinst_LTLIBRARIES = libbackends.la
-libbackends_la_SOURCES =
-
-noinst_HEADERS = ConsoleLogger.h FileLogger.h
diff --git a/src/Common/Backends/Makefile.in b/src/Common/Backends/Makefile.in
deleted file mode 100644
index 220394c..0000000
--- a/src/Common/Backends/Makefile.in
+++ /dev/null
@@ -1,447 +0,0 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = src/Common/Backends
-DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/argz.m4 \
- $(top_srcdir)/m4/ax_lib_mysql.m4 $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \
- $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
- $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/pkg.m4 \
- $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-libbackends_la_LIBADD =
-am_libbackends_la_OBJECTS =
-libbackends_la_OBJECTS = $(am_libbackends_la_OBJECTS)
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
-SOURCES = $(libbackends_la_SOURCES)
-DIST_SOURCES = $(libbackends_la_SOURCES)
-HEADERS = $(noinst_HEADERS)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AR = @AR@
-ARGZ_H = @ARGZ_H@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GREP = @GREP@
-GSSAPI_LIBS = @GSSAPI_LIBS@
-GnuTLS_CFLAGS = @GnuTLS_CFLAGS@
-GnuTLS_LIBS = @GnuTLS_LIBS@
-INCLTDL = @INCLTDL@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBADD_DL = @LIBADD_DL@
-LIBADD_DLD_LINK = @LIBADD_DLD_LINK@
-LIBADD_DLOPEN = @LIBADD_DLOPEN@
-LIBADD_SHL_LOAD = @LIBADD_SHL_LOAD@
-LIBLTDL = @LIBLTDL@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTDLDEPS = @LTDLDEPS@
-LTDLINCL = @LTDLINCL@
-LTDLOPEN = @LTDLOPEN@
-LTLIBOBJS = @LTLIBOBJS@
-LT_CONFIG_H = @LT_CONFIG_H@
-LT_DLLOADERS = @LT_DLLOADERS@
-LT_DLPREOPEN = @LT_DLPREOPEN@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MKDIR_P = @MKDIR_P@
-MYSQL_CFLAGS = @MYSQL_CFLAGS@
-MYSQL_CONFIG = @MYSQL_CONFIG@
-MYSQL_LDFLAGS = @MYSQL_LDFLAGS@
-MYSQL_VERSION = @MYSQL_VERSION@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-PKG_CONFIG = @PKG_CONFIG@
-RANLIB = @RANLIB@
-READLINE_LIBS = @READLINE_LIBS@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STRIP = @STRIP@
-VERSION = @VERSION@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-have_df = @have_df@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-lt_ECHO = @lt_ECHO@
-ltdl_LIBOBJS = @ltdl_LIBOBJS@
-ltdl_LTLIBOBJS = @ltdl_LTLIBOBJS@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-sigc_CFLAGS = @sigc_CFLAGS@
-sigc_LIBS = @sigc_LIBS@
-srcdir = @srcdir@
-sys_symbol_underscore = @sys_symbol_underscore@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-noinst_LTLIBRARIES = libbackends.la
-libbackends_la_SOURCES =
-noinst_HEADERS = ConsoleLogger.h FileLogger.h
-all: all-am
-
-.SUFFIXES:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Common/Backends/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu src/Common/Backends/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-clean-noinstLTLIBRARIES:
- -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
- @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
- dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
- echo "rm -f \"$${dir}/so_locations\""; \
- rm -f "$${dir}/so_locations"; \
- done
-libbackends.la: $(libbackends_la_OBJECTS) $(libbackends_la_DEPENDENCIES)
- $(LINK) $(libbackends_la_OBJECTS) $(libbackends_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT)
-
-distclean-compile:
- -rm -f *.tab.c
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
- fi
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-am
-all-am: Makefile $(LTLIBRARIES) $(HEADERS)
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
- mostlyclean-am
-
-distclean: distclean-am
- -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-info: install-info-am
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-ps: install-ps-am
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-noinstLTLIBRARIES ctags distclean \
- distclean-compile distclean-generic distclean-libtool \
- distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/src/Common/LogManager.cpp b/src/Common/LogManager.cpp
index 5182a97..61c4bb6 100644
--- a/src/Common/LogManager.cpp
+++ b/src/Common/LogManager.cpp
@@ -19,8 +19,6 @@
#include "LogManager.h"
#include "ConfigEntry.h"
-#include "Backends/ConsoleLogger.h"
-#include "Backends/FileLogger.h"
namespace Mad {
namespace Common {
@@ -49,10 +47,10 @@ bool LogManager::handleConfigEntry(const ConfigEntry &entry, bool handled) {
}
void LogManager::configFinished() {
- if(loggers.empty())
- registerLogger(static_cast<Logger*>(&consoleLogger));
+ if(loggers.empty())
+ registerLogger(static_cast<Logger*>(&consoleLogger));
- std::auto_ptr<std::queue<Message> > queue = messageQueue;
+ std::auto_ptr<std::queue<Message> > queue = messageQueue;
while(!queue->empty()) {
const Message &message = queue->front();
diff --git a/src/Common/LogManager.h b/src/Common/LogManager.h
index 5fc3824..5f2fb17 100644
--- a/src/Common/LogManager.h
+++ b/src/Common/LogManager.h
@@ -23,8 +23,8 @@
#include "Configurable.h"
#include "Logger.h"
#include "RemoteLogger.h"
-#include "Backends/ConsoleLogger.h"
+#include <iostream>
#include <memory>
#include <queue>
#include <set>
@@ -52,9 +52,23 @@ class LogManager : public Configurable {
std::string source;
};
+ class ConsoleLogger : public Logger, public RemoteLogger {
+ protected:
+ virtual void logMessage(MessageCategory, MessageLevel, time_t, const std::string &message) {
+ std::cerr << message << std::endl;
+ }
+ virtual void logMessage(MessageCategory, MessageLevel, time_t, const std::string &message, const std::string &messageSource) {
+ std::cerr << message << " from "<< messageSource << std::endl;
+ }
+
+ public:
+ ConsoleLogger() {}
+ };
+
+
static LogManager logManager;
- Backends::ConsoleLogger consoleLogger;
+ ConsoleLogger consoleLogger;
std::set<Logger*> loggers;
std::set<RemoteLogger*> remoteLoggers;
diff --git a/src/Common/Makefile.am b/src/Common/Makefile.am
index 4494745..e41b63b 100644
--- a/src/Common/Makefile.am
+++ b/src/Common/Makefile.am
@@ -1,9 +1,9 @@
-SUBDIRS = Backends Requests RequestHandlers
+SUBDIRS = Requests RequestHandlers
noinst_LTLIBRARIES = libcommon.la
libcommon_la_SOURCES = ConfigEntry.cpp ConfigManager.cpp Exception.cpp Initializable.cpp Logger.cpp \
LogManager.cpp ModuleManager.cpp RequestManager.cpp SystemBackend.cpp Tokenizer.cpp
-libcommon_la_LIBADD = Backends/libbackends.la Requests/librequests.la RequestHandlers/librequesthandlers.la
+libcommon_la_LIBADD = Requests/librequests.la RequestHandlers/librequesthandlers.la
noinst_HEADERS = ConfigEntry.h ConfigManager.h Configurable.h Exception.h HostInfo.h Initializable.h \
Logger.h LoggerBase.h LogManager.h ModuleManager.h RemoteLogger.h Request.h \
diff --git a/src/Common/Makefile.in b/src/Common/Makefile.in
index ed307b0..665d78a 100644
--- a/src/Common/Makefile.in
+++ b/src/Common/Makefile.in
@@ -49,8 +49,8 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
-libcommon_la_DEPENDENCIES = Backends/libbackends.la \
- Requests/librequests.la RequestHandlers/librequesthandlers.la
+libcommon_la_DEPENDENCIES = Requests/librequests.la \
+ RequestHandlers/librequesthandlers.la
am_libcommon_la_OBJECTS = ConfigEntry.lo ConfigManager.lo Exception.lo \
Initializable.lo Logger.lo LogManager.lo ModuleManager.lo \
RequestManager.lo SystemBackend.lo Tokenizer.lo
@@ -225,12 +225,12 @@ sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-SUBDIRS = Backends Requests RequestHandlers
+SUBDIRS = Requests RequestHandlers
noinst_LTLIBRARIES = libcommon.la
libcommon_la_SOURCES = ConfigEntry.cpp ConfigManager.cpp Exception.cpp Initializable.cpp Logger.cpp \
LogManager.cpp ModuleManager.cpp RequestManager.cpp SystemBackend.cpp Tokenizer.cpp
-libcommon_la_LIBADD = Backends/libbackends.la Requests/librequests.la RequestHandlers/librequesthandlers.la
+libcommon_la_LIBADD = Requests/librequests.la RequestHandlers/librequesthandlers.la
noinst_HEADERS = ConfigEntry.h ConfigManager.h Configurable.h Exception.h HostInfo.h Initializable.h \
Logger.h LoggerBase.h LogManager.h ModuleManager.h RemoteLogger.h Request.h \
RequestBase.h RequestHandler.h RequestManager.h SystemBackend.h Tokenizer.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 6abbbe1..529200f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,7 +1,7 @@
SUBDIRS = Common Client Core Daemon Net modules
-daemon_modules =
-core_modules =
+daemon_modules = -dlpreopen modules/FileLogger.la
+core_modules = -dlpreopen modules/FileLogger.la
if SYSTEMBACKEND_POSIX
daemon_modules += -dlpreopen modules/SystemBackendPosix.la
@@ -14,7 +14,7 @@ core_modules += -dlpreopen modules/SystemBackendProc.la
endif
if USERBACKEND_MYSQL
-core_modules += -dlopen modules/UserBackendMysql.la"
+core_modules += -dlopen modules/UserBackendMysql.la
endif
bin_PROGRAMS = mad madc mad-core
diff --git a/src/Makefile.in b/src/Makefile.in
index 5b4e33c..3d29ff8 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -36,7 +36,7 @@ host_triplet = @host@
@SYSTEMBACKEND_POSIX_TRUE@am__append_2 = -dlpreopen modules/SystemBackendPosix.la
@SYSTEMBACKEND_PROC_TRUE@am__append_3 = -dlpreopen modules/SystemBackendProc.la
@SYSTEMBACKEND_PROC_TRUE@am__append_4 = -dlpreopen modules/SystemBackendProc.la
-@USERBACKEND_MYSQL_TRUE@am__append_5 = -dlopen modules/UserBackendMysql.la"
+@USERBACKEND_MYSQL_TRUE@am__append_5 = -dlopen modules/UserBackendMysql.la
bin_PROGRAMS = mad$(EXEEXT) madc$(EXEEXT) mad-core$(EXEEXT)
subdir = src
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
@@ -246,8 +246,10 @@ target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
SUBDIRS = Common Client Core Daemon Net modules
-daemon_modules = $(am__append_1) $(am__append_3)
-core_modules = $(am__append_2) $(am__append_4) $(am__append_5)
+daemon_modules = -dlpreopen modules/FileLogger.la $(am__append_1) \
+ $(am__append_3)
+core_modules = -dlpreopen modules/FileLogger.la $(am__append_2) \
+ $(am__append_4) $(am__append_5)
mad_SOURCES = mad.cpp
mad_LDADD = Daemon/libdaemon.la Common/libcommon.la Net/libnet.la \
$(sigc_LIBS) $(GnuTLS_LIBS) @LIBLTDL@
diff --git a/src/mad-core.conf b/src/mad-core.conf
index b57ab97..7a54a41 100644
--- a/src/mad-core.conf
+++ b/src/mad-core.conf
@@ -1,4 +1,5 @@
Logger Console
+Logger File "mad-core.log"
Listen *
diff --git a/src/mad-core.cpp b/src/mad-core.cpp
index 05051ad..0bc8909 100644
--- a/src/mad-core.cpp
+++ b/src/mad-core.cpp
@@ -37,12 +37,13 @@ int main() {
Core::ConnectionManager::get()->init();
- Common::ConfigManager::get()->loadFile("mad-core.conf");
- Common::ConfigManager::get()->finish();
-
+ Common::ModuleManager::get()->loadModule("FileLogger");
Common::ModuleManager::get()->loadModule("SystemBackendPosix");
Common::ModuleManager::get()->loadModule("SystemBackendProc");
+ Common::ConfigManager::get()->loadFile("mad-core.conf");
+ Common::ConfigManager::get()->finish();
+
while(true)
Core::ConnectionManager::get()->run();
diff --git a/src/mad.cpp b/src/mad.cpp
index f5fcaa6..74ddd7a 100644
--- a/src/mad.cpp
+++ b/src/mad.cpp
@@ -44,6 +44,10 @@ static void requestFinished(const Common::Request<>&) {
int main() {
Net::Connection::init();
+ Common::ModuleManager::get()->loadModule("FileLogger");
+ Common::ModuleManager::get()->loadModule("SystemBackendPosix");
+ Common::ModuleManager::get()->loadModule("SystemBackendProc");
+
Common::ConfigManager::get()->finish();
Common::RequestManager::get()->registerPacketType<Common::RequestHandlers::FSInfoRequestHandler>(Net::Packet::FS_INFO);
@@ -51,9 +55,6 @@ int main() {
Common::RequestManager::get()->registerPacketType<Daemon::RequestHandlers::CommandRequestHandler>(Net::Packet::COMMAND_REBOOT);
Common::RequestManager::get()->registerPacketType<Daemon::RequestHandlers::CommandRequestHandler>(Net::Packet::COMMAND_SHUTDOWN);
- Common::ModuleManager::get()->loadModule("SystemBackendPosix");
- Common::ModuleManager::get()->loadModule("SystemBackendProc");
-
Net::ClientConnection *connection = new Net::ClientConnection;
try {
diff --git a/src/modules/FileLogger.cpp b/src/modules/FileLogger.cpp
new file mode 100644
index 0000000..5e0c021
--- /dev/null
+++ b/src/modules/FileLogger.cpp
@@ -0,0 +1,73 @@
+/*
+ * FileLogger.cpp
+ *
+ * Copyright (C) 2008 Matthias Schiffer <matthias@gamezock.de>
+ *
+ * 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 3 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "FileLogger.h"
+
+#include <Common/ConfigEntry.h>
+
+#define init FileLogger_LTX_init
+#define deinit FileLogger_LTX_deinit
+
+
+namespace Mad {
+namespace Modules {
+
+FileLogger::ConfigHelper FileLogger::configHelper;
+std::set<FileLogger*> FileLogger::loggers;
+
+
+bool FileLogger::ConfigHelper::handleConfigEntry(const Common::ConfigEntry &entry, bool handled) {
+ if(handled)
+ return false;
+
+ if(entry[0].getKey().matches("Logger")) {
+ if(entry[0][0].matches("File")) {
+ if(entry[1].empty()) {
+ if(!entry[0][1].empty()) {
+ FileLogger *logger = new FileLogger(entry[0][1]);
+
+ loggers.insert(logger);
+ Common::LogManager::get()->registerLogger(static_cast<Logger*>(logger));
+ }
+ else {
+ Logger::logf(Logger::WARNING, "FileLogger: no filename given.");
+ }
+
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+}
+}
+
+extern "C" {
+
+void init() {
+ Mad::Modules::FileLogger::registerConfigHelper();
+}
+
+void deinit() {
+ Mad::Modules::FileLogger::unregisterConfigHelper();
+}
+
+}
diff --git a/src/Common/Backends/FileLogger.h b/src/modules/FileLogger.h
index 59d2e16..2def986 100644
--- a/src/Common/Backends/FileLogger.h
+++ b/src/modules/FileLogger.h
@@ -17,20 +17,31 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef MAD_COMMON_BACKENDS_FILELOGGER_H_
-#define MAD_COMMON_BACKENDS_FILELOGGER_H_
+#ifndef MAD_MODULES_FILELOGGER_H_
+#define MAD_MODULES_FILELOGGER_H_
+
+#include <Common/ConfigManager.h>
+#include <Common/Configurable.h>
+#include <Common/LogManager.h>
-#include "../Logger.h"
-#include "../RemoteLogger.h"
#include <fstream>
-#include <ctime>
namespace Mad {
-namespace Common {
-namespace Backends {
+namespace Modules {
-class FileLogger : public Logger, public RemoteLogger {
+class FileLogger : private Common::Logger, private Common::RemoteLogger {
private:
+ class ConfigHelper : public Common::Configurable {
+ protected:
+ virtual bool handleConfigEntry(const Common::ConfigEntry &entry, bool handled);
+
+ public:
+ virtual int getPriority() const {return 1;}
+ };
+
+ static ConfigHelper configHelper;
+ static std::set<FileLogger*> loggers;
+
std::ofstream file;
protected:
@@ -44,10 +55,23 @@ class FileLogger : public Logger, public RemoteLogger {
public:
FileLogger(const std::string &filename)
: file(filename.c_str(), std::ios::out|std::ios::app) {}
+
+ static void registerConfigHelper() {
+ Common::ConfigManager::get()->registerConfigurable(&configHelper);
+ }
+
+ static void unregisterConfigHelper() {
+ Common::ConfigManager::get()->unregisterConfigurable(&configHelper);
+
+ for(std::set<FileLogger*>::iterator logger = loggers.begin(); logger != loggers.end(); ++logger) {
+ delete *logger;
+ }
+
+ loggers.clear();
+ }
};
}
}
-}
-#endif /* MAD_COMMON_BACKENDS_FILELOGGER_H_ */
+#endif /* MAD_MODULES_FILELOGGER_H_ */
diff --git a/src/modules/Makefile.am b/src/modules/Makefile.am
index 5e12a5d..67a82b8 100644
--- a/src/modules/Makefile.am
+++ b/src/modules/Makefile.am
@@ -1,12 +1,12 @@
-madlibdir = ${libdir}/mad
-moddir = ${madlibdir}/modules
+moddir = ${pkglibdir}/modules
default_ldflags = -module -avoid-version -export-dynamic
+static_ldflags = $(default_ldflags) -static -rpath $(moddir)
EXTRA_LTLIBTRARIES = SystemBackendPosix.la SystemBackendProc.la UserBackendMysql.la
-mod_LTLIBRARIES =
-noinst_LTLIBRARIES =
+mod_LTLIBRARIES =
+noinst_LTLIBRARIES = FileLogger.la
if SYSTEMBACKEND_POSIX
noinst_LTLIBRARIES += SystemBackendPosix.la
@@ -20,12 +20,15 @@ if USERBACKEND_MYSQL
mod_LTLIBRARIES += UserBackendMysql.la
endif
+FileLogger_la_SOURCES = FileLogger.cpp
+FileLogger_la_LDFLAGS = $(static_ldflags) -export-symbols-regex '^FileLogger_LTX_'
+
SystemBackendPosix_la_SOURCES = SystemBackendPosix.cpp
SystemBackendPosix_la_LIBADD = $(sigc_LIBS)
-SystemBackendPosix_la_LDFLAGS = $(default_ldflags) -static -export-symbols-regex '^SystemBackendPosix_LTX_'
+SystemBackendPosix_la_LDFLAGS = $(static_ldflags) -export-symbols-regex '^SystemBackendPosix_LTX_'
SystemBackendProc_la_SOURCES = SystemBackendProc.cpp
-SystemBackendProc_la_LDFLAGS = $(default_ldflags) -static -export-symbols-regex '^SystemBackendProc_LTX_'
+SystemBackendProc_la_LDFLAGS = $(static_ldflags) -export-symbols-regex '^SystemBackendProc_LTX_'
UserBackendMysql_la_SOURCES = UserBackendMysql.cpp
UserBackendMysql_la_LIBADD = $(MYSQL_LDFLAGS)
diff --git a/src/modules/Makefile.in b/src/modules/Makefile.in
index 59909ee..f396b8d 100644
--- a/src/modules/Makefile.in
+++ b/src/modules/Makefile.in
@@ -60,6 +60,12 @@ am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__installdirs = "$(DESTDIR)$(moddir)"
modLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(mod_LTLIBRARIES) $(noinst_LTLIBRARIES)
+FileLogger_la_LIBADD =
+am_FileLogger_la_OBJECTS = FileLogger.lo
+FileLogger_la_OBJECTS = $(am_FileLogger_la_OBJECTS)
+FileLogger_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(FileLogger_la_LDFLAGS) $(LDFLAGS) -o $@
am__DEPENDENCIES_1 =
SystemBackendPosix_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
am_SystemBackendPosix_la_OBJECTS = SystemBackendPosix.lo
@@ -95,9 +101,10 @@ CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-SOURCES = $(SystemBackendPosix_la_SOURCES) \
+SOURCES = $(FileLogger_la_SOURCES) $(SystemBackendPosix_la_SOURCES) \
$(SystemBackendProc_la_SOURCES) $(UserBackendMysql_la_SOURCES)
-DIST_SOURCES = $(SystemBackendPosix_la_SOURCES) \
+DIST_SOURCES = $(FileLogger_la_SOURCES) \
+ $(SystemBackendPosix_la_SOURCES) \
$(SystemBackendProc_la_SOURCES) $(UserBackendMysql_la_SOURCES)
HEADERS = $(noinst_HEADERS)
ETAGS = etags
@@ -245,17 +252,19 @@ sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-madlibdir = ${libdir}/mad
-moddir = ${madlibdir}/modules
+moddir = ${pkglibdir}/modules
default_ldflags = -module -avoid-version -export-dynamic
+static_ldflags = $(default_ldflags) -static -rpath $(moddir)
EXTRA_LTLIBTRARIES = SystemBackendPosix.la SystemBackendProc.la UserBackendMysql.la
mod_LTLIBRARIES = $(am__append_3)
-noinst_LTLIBRARIES = $(am__append_1) $(am__append_2)
+noinst_LTLIBRARIES = FileLogger.la $(am__append_1) $(am__append_2)
+FileLogger_la_SOURCES = FileLogger.cpp
+FileLogger_la_LDFLAGS = $(static_ldflags) -export-symbols-regex '^FileLogger_LTX_'
SystemBackendPosix_la_SOURCES = SystemBackendPosix.cpp
SystemBackendPosix_la_LIBADD = $(sigc_LIBS)
-SystemBackendPosix_la_LDFLAGS = $(default_ldflags) -static -export-symbols-regex '^SystemBackendPosix_LTX_'
+SystemBackendPosix_la_LDFLAGS = $(static_ldflags) -export-symbols-regex '^SystemBackendPosix_LTX_'
SystemBackendProc_la_SOURCES = SystemBackendProc.cpp
-SystemBackendProc_la_LDFLAGS = $(default_ldflags) -static -export-symbols-regex '^SystemBackendProc_LTX_'
+SystemBackendProc_la_LDFLAGS = $(static_ldflags) -export-symbols-regex '^SystemBackendProc_LTX_'
UserBackendMysql_la_SOURCES = UserBackendMysql.cpp
UserBackendMysql_la_LIBADD = $(MYSQL_LDFLAGS)
UserBackendMysql_la_LDFLAGS = $(default_ldflags) -export-symbols-regex '^UserBackendMysql_LTX_'
@@ -329,6 +338,8 @@ clean-noinstLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
+FileLogger.la: $(FileLogger_la_OBJECTS) $(FileLogger_la_DEPENDENCIES)
+ $(FileLogger_la_LINK) $(FileLogger_la_OBJECTS) $(FileLogger_la_LIBADD) $(LIBS)
SystemBackendPosix.la: $(SystemBackendPosix_la_OBJECTS) $(SystemBackendPosix_la_DEPENDENCIES)
$(SystemBackendPosix_la_LINK) $(am_SystemBackendPosix_la_rpath) $(SystemBackendPosix_la_OBJECTS) $(SystemBackendPosix_la_LIBADD) $(LIBS)
SystemBackendProc.la: $(SystemBackendProc_la_OBJECTS) $(SystemBackendProc_la_DEPENDENCIES)
@@ -342,6 +353,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileLogger.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SystemBackendPosix.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SystemBackendProc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UserBackendMysql.Plo@am__quote@