[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[myserver-commit] [2834] Added the new LogManager.
From: |
Francesco Pipita |
Subject: |
[myserver-commit] [2834] Added the new LogManager. |
Date: |
Mon, 22 Sep 2008 20:20:18 +0000 |
Revision: 2834
http://svn.sv.gnu.org/viewvc/?view=rev&root=myserver&revision=2834
Author: francesco_pipita
Date: 2008-09-22 20:20:14 +0000 (Mon, 22 Sep 2008)
Log Message:
-----------
Added the new LogManager.
Modified Paths:
--------------
trunk/myserver/AUTHORS
trunk/myserver/configure.in
trunk/myserver/include/filter/Makefile.am
trunk/myserver/include/filter/filters_chain.h
trunk/myserver/include/log/Makefile.am
trunk/myserver/include/log/log_manager.h
trunk/myserver/src/filter/Makefile.am
trunk/myserver/src/filter/filters_chain.cpp
trunk/myserver/src/log/Makefile.am
trunk/myserver/src/log/log_manager.cpp
trunk/myserver/tests/Makefile.am
Added Paths:
-----------
trunk/myserver/include/filter/console.h
trunk/myserver/include/log/stream/
trunk/myserver/include/log/stream/Makefile.am
trunk/myserver/include/log/stream/console_stream.h
trunk/myserver/include/log/stream/console_stream_creator.h
trunk/myserver/include/log/stream/file_stream.h
trunk/myserver/include/log/stream/file_stream_creator.h
trunk/myserver/include/log/stream/log_stream.h
trunk/myserver/include/log/stream/log_stream_creator.h
trunk/myserver/include/log/stream/log_stream_factory.h
trunk/myserver/include/log/stream/socket_stream.h
trunk/myserver/include/log/stream/socket_stream_creator.h
trunk/myserver/src/filter/console.cpp
trunk/myserver/src/log/stream/
trunk/myserver/src/log/stream/Makefile.am
trunk/myserver/src/log/stream/console_stream.cpp
trunk/myserver/src/log/stream/console_stream_creator.cpp
trunk/myserver/src/log/stream/file_stream.cpp
trunk/myserver/src/log/stream/file_stream_creator.cpp
trunk/myserver/src/log/stream/log_stream.cpp
trunk/myserver/src/log/stream/log_stream_creator.cpp
trunk/myserver/src/log/stream/log_stream_factory.cpp
trunk/myserver/src/log/stream/socket_stream.cpp
trunk/myserver/src/log/stream/socket_stream_creator.cpp
Modified: trunk/myserver/AUTHORS
===================================================================
--- trunk/myserver/AUTHORS 2008-09-21 20:49:18 UTC (rev 2833)
+++ trunk/myserver/AUTHORS 2008-09-22 20:20:14 UTC (rev 2834)
@@ -8,3 +8,4 @@
Russ Bohnhoff <address@hidden>
Alexandru Iancu <address@hidden>
Giuseppe Scrivano <address@hidden>
+Francesco Pipita <address@hidden>
Modified: trunk/myserver/configure.in
===================================================================
--- trunk/myserver/configure.in 2008-09-21 20:49:18 UTC (rev 2833)
+++ trunk/myserver/configure.in 2008-09-22 20:20:14 UTC (rev 2834)
@@ -391,6 +391,7 @@
include/Makefile
include/connection/Makefile
include/log/Makefile
+ include/log/stream/Makefile
include/conf/Makefile
include/conf/mime/Makefile
include/conf/security/Makefile
@@ -444,6 +445,7 @@
src/Makefile
src/connection/Makefile
src/log/Makefile
+ src/log/stream/Makefile
src/conf/Makefile
src/conf/mime/Makefile
src/conf/security/Makefile
Modified: trunk/myserver/include/filter/Makefile.am
===================================================================
--- trunk/myserver/include/filter/Makefile.am 2008-09-21 20:49:18 UTC (rev
2833)
+++ trunk/myserver/include/filter/Makefile.am 2008-09-22 20:20:14 UTC (rev
2834)
@@ -1,3 +1,3 @@
-include_HEADERS = filter.h filters_chain.h filters_factory.h memory_stream.h
stream.h
+include_HEADERS = filter.h filters_chain.h filters_factory.h memory_stream.h
stream.h console.h
SUBDIRS = gzip
Added: trunk/myserver/include/filter/console.h
===================================================================
--- trunk/myserver/include/filter/console.h (rev 0)
+++ trunk/myserver/include/filter/console.h 2008-09-22 20:20:14 UTC (rev
2834)
@@ -0,0 +1,37 @@
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 CONSOLE_H
+#define CONSOLE_H
+
+#include <iostream>
+
+#include <include/filter/stream.h>
+
+using namespace std;
+
+class Console : public Stream
+{
+ public:
+ Console();
+ virtual ~Console();
+ virtual int flush (u_long* nbw);
+ virtual int read (char* buffer, u_long len, u_long* nbr);
+ virtual int write (const char* buffer, u_long len, u_long* nbw);
+};
+
+#endif
Modified: trunk/myserver/include/filter/filters_chain.h
===================================================================
--- trunk/myserver/include/filter/filters_chain.h 2008-09-21 20:49:18 UTC
(rev 2833)
+++ trunk/myserver/include/filter/filters_chain.h 2008-09-22 20:20:14 UTC
(rev 2834)
@@ -59,6 +59,7 @@
int clear();
void getName(string& out);
int hasModifiersFilters();
+ list<string> getFilters ();
virtual int read(char* buffer, u_long len, u_long*);
virtual int write(const char* buffer, u_long len, u_long*);
virtual int flush(u_long*);
Modified: trunk/myserver/include/log/Makefile.am
===================================================================
--- trunk/myserver/include/log/Makefile.am 2008-09-21 20:49:18 UTC (rev
2833)
+++ trunk/myserver/include/log/Makefile.am 2008-09-22 20:20:14 UTC (rev
2834)
@@ -1,3 +1,3 @@
include_HEADERS = log_manager.h
-SUBDIRS =
+SUBDIRS = stream
Modified: trunk/myserver/include/log/log_manager.h
===================================================================
--- trunk/myserver/include/log/log_manager.h 2008-09-21 20:49:18 UTC (rev
2833)
+++ trunk/myserver/include/log/log_manager.h 2008-09-22 20:20:14 UTC (rev
2834)
@@ -1,7 +1,7 @@
/* -*- mode: c++ -*- */
/*
MyServer
-Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
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
@@ -19,60 +19,227 @@
#ifndef LOG_MANAGER_H
#define LOG_MANAGER_H
-#include "stdafx.h"
-#include <include/base/file/file.h>
-#include <include/base/thread/thread.h>
+#include <map>
+#include <string>
+
#include <include/base/sync/mutex.h>
+#include <include/filter/filters_factory.h>
+#include <include/log/stream/log_stream.h>
+#include <include/log/stream/log_stream_factory.h>
+#include <include/filter/gzip/gzip.h>
-#include <string>
using namespace std;
+
+/*!
+ * Defines different types of logging level.
+ */
+enum LoggingLevel
+ {
+ INFO,
+ WARNING,
+ ERROR
+ };
+
+
class LogManager
{
-private:
- File file;
- int type;
+public:
+
+
/*!
- *loaded is used to store if the file object is initialized correctly.
+ * Default constructor. It is only used to support the old
+ * interface.
*/
- int loaded;
+ LogManager ();
+
+
+ LogManager (FiltersFactory* filtersFactory,
+ LogStreamFactory* logStreamFactory,
+ LoggingLevel level = WARNING);
+
+
+ /*!
+ * Deallocates all LogStream owned by the LogManager and
+ * other objects (like the Mutex and the LogStreamFactory)
+ * allocated by the LogManager.
+ */
+ ~LogManager ();
+
+
+ /*!
+ * Add a new LogStream to the LogManager. Prevents duplicate
+ * LogStream being added.
+ * \param location The location where the new LogStream will point.
+ * \param filters A list of filters used within the new LogStream.
+ * \param cycleLog A non-zero value establishes the threshold for
+ * the LogStream's growth before cycling it.
+ */
+ void addLogStream (string& location,
+ list<string>& filters,
+ u_long cycleLog);
+
+
+ /*!
+ * Remove the LogStream that point to location if it exists.
+ * \param location The location where the LogStream which has to
+ * be removed points to.
+ */
+ void removeLogStream (string& location);
+
+
+ LogStream* getLogStream (string& location);
+
+
+ /*!
+ * Write `message' to the LogStream that points to `location'. If
+ * no location is provided, it writes the message on all LogStreams
+ * owned by this LogManager.
+ * \param message The message string to write.
+ * \param level The message logging level. If it is lower than the
+ * LogManager's logging level, the LogManager discards it.
+ * \param location The location where `message' will be written.
+ * \return 0 on success.
+ */
+ int log (string& message,
+ LoggingLevel level = WARNING,
+ string location = "all");
+
+
+ /*!
+ * Close the LogStream that points to `location'. If no location
+ * is provided, it closes all LogStreams owned by this LogManager.
+ * \return 0 on success.
+ */
+ int close (string location = "all");
+
+
+ /*!
+ * \return The cycleLog value for the LogStream that points to
+ * location.
+ */
+ u_long getCycleLog (string& location);
+
+
+ /*!
+ * Set the cycleLog field for the LogStream that points to `location'.
+ * If no location is provided, it will set the cycleLog to the same value
+ * for all LogStreams.
+ * \param cycleLog The new cycleLog value.
+ * \param location The LogStream whose cycleLog will be changed.
+ */
+ void setCycleLog (u_long cycleLog,
+ string location);
+
+
+ /*!
+ * Set the default logging level.
+ * \param level The new logging level value.
+ * \return The old logging level.
+ */
+ LoggingLevel setLoggingLevel (LoggingLevel level);
+
+
+ LoggingLevel getLoggingLevel ();
+
+
+ void setLogStreamFactory (LogStreamFactory* logStreamFactory);
+
+
+ LogStreamFactory* getLogStreamFactory ();
+
+
+ void setFiltersFactory (FiltersFactory* filtersFactory);
+
+
+ FiltersFactory* getFiltersFactory ();
+
+
+ int size ();
+
+
+ bool empty ();
+
+
+ bool contains (string& location);
+
+
+ /*!
+ * Delete all LogStream objects owned by this LogManager.
+ */
+ void clear ();
+
+
+ /*!
+ * Deprecated methods and fields.
+ */
+ int getLogSize ();
+ int storeFile ();
+ int load (char const*);
+ void setGzip (int);
+ int write (char const*, int len = 0);
+ int writeln (char const*);
+ File* getFile ();
+ u_long setMaxSize (u_long);
+ u_long getMaxSize ();
+ int getType ();
+ int getGzip ();
+ void setType (int);
+ int preparePrintError ();
+ int endPrintError ();
+ int requestAccess ();
+ int terminateAccess ();
+ void setCycleLog (u_long);
+ int const static TYPE_CONSOLE;
+ int const static TYPE_FILE;
+ int type;
+ int gzipLog;
+ int cycleLog;
u_long maxSize;
- Mutex mutex;
- int cycleLog;
- int gzipLog;
-public:
- void setGzip(bool);
- int getGzip();
- void setCycleLog(int);
- int getCycleLog();
- const static int TYPE_CONSOLE;
- const static int TYPE_FILE;
- File *getFile();
- LogManager();
- ~LogManager();
- u_long setMaxSize( u_long );
- u_long getMaxSize();
- int requestAccess();
- int terminateAccess();
+protected:
- int load(const char *filename );
- int load(string const &filename)
- {return load(filename.c_str());}
- int close();
- int preparePrintError();
- int endPrintError();
- void setType( int );
- int getType();
- int write( const char *str, int len = 0 );
- int writeln(const char *);
+ /*!
+ * Send events to LogStreams.
+ * \param evt The event that should be notified to LogStreams.
+ * \param message The message to deliver.
+ * \param reply The receiver will put its data here.
+ * \return 0 on success.
+ */
+ int notifyLogStreams (LogStreamEvent evt,
+ void* message = 0,
+ void* reply = 0);
+private:
- int write(string const &str, int len = 0 )
- {return write(str.c_str(), len);}
- int writeln(string const& str)
- {return writeln(str.c_str());}
- int getLogSize();
- int storeFile();
+ /*!
+ * Hold the default logging level for the LogManager.
+ */
+ LoggingLevel level;
+
+
+ /*!
+ * Ensure atomic operations to prevent interleaving.
+ */
+ Mutex* mutex;
+
+
+ /*!
+ * The LogStream creator.
+ */
+ LogStreamFactory* logStreamFactory;
+
+
+ /*!
+ * The Filter creator.
+ */
+ FiltersFactory* filtersFactory;
+
+
+ /*!
+ * Hold all LogStream owned by this LogManager.
+ */
+ map<string, LogStream*> logStreams;
};
+
#endif
Added: trunk/myserver/include/log/stream/Makefile.am
===================================================================
--- trunk/myserver/include/log/stream/Makefile.am
(rev 0)
+++ trunk/myserver/include/log/stream/Makefile.am 2008-09-22 20:20:14 UTC
(rev 2834)
@@ -0,0 +1,5 @@
+include_HEADERS = console_stream.h file_stream.h log_stream.h \
+ log_stream_factory.h log_stream_creator.h \
+ file_stream_creator.h console_stream_creator.h \
+ socket_stream.h socket_stream_creator.h
+SUBDIRS =
Added: trunk/myserver/include/log/stream/console_stream.h
===================================================================
--- trunk/myserver/include/log/stream/console_stream.h
(rev 0)
+++ trunk/myserver/include/log/stream/console_stream.h 2008-09-22 20:20:14 UTC
(rev 2834)
@@ -0,0 +1,37 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 CONSOLE_STREAM_H
+#define CONSOLE_STREAM_H
+
+#include <list>
+#include <string>
+
+#include <include/log/stream/log_stream.h>
+#include <include/filter/console.h>
+
+class ConsoleStream : public LogStream
+{
+ public:
+ ConsoleStream (FiltersFactory* filtersFactory,
+ u_long cycleLog,
+ Stream* outStream,
+ FiltersChain* filtersChain);
+};
+
+#endif
Property changes on: trunk/myserver/include/log/stream/console_stream.h
___________________________________________________________________
Name: svn:mergeinfo
+
Added: trunk/myserver/include/log/stream/console_stream_creator.h
===================================================================
--- trunk/myserver/include/log/stream/console_stream_creator.h
(rev 0)
+++ trunk/myserver/include/log/stream/console_stream_creator.h 2008-09-22
20:20:14 UTC (rev 2834)
@@ -0,0 +1,34 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 CONSOLE_STREAM_CREATOR_H
+#define CONSOLE_STREAM_CREATOR_H
+
+#include <include/log/stream/log_stream_creator.h>
+#include <include/log/stream/console_stream.h>
+
+class ConsoleStreamCreator : public LogStreamCreator
+{
+ public:
+ virtual LogStream* create (FiltersFactory* filtersFactory,
+ string& location,
+ list<string>& filters,
+ u_long cycleLog);
+};
+
+#endif
Added: trunk/myserver/include/log/stream/file_stream.h
===================================================================
--- trunk/myserver/include/log/stream/file_stream.h
(rev 0)
+++ trunk/myserver/include/log/stream/file_stream.h 2008-09-22 20:20:14 UTC
(rev 2834)
@@ -0,0 +1,58 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 FILE_STREAM_H
+#define FILE_STREAM_H
+
+#include <list>
+#include <sstream>
+#include <string>
+
+#include <include/base/file/file.h>
+#include <include/base/file/files_utility.h>
+#include <include/base/string/stringutils.h>
+#include <include/base/utility.h>
+#include <include/log/stream/log_stream.h>
+
+class FileStream : public LogStream
+{
+ public:
+
+
+ FileStream (FiltersFactory* filtersFactory,
+ u_long cycleLog,
+ Stream* outStream,
+ FiltersChain* filtersChain);
+
+
+ /*!
+ * The default file mask used to create a log file.
+ */
+ int const static defaultFileMask;
+
+
+ virtual u_long streamSize ();
+
+
+ protected:
+
+
+ virtual int streamCycle ();
+};
+
+#endif
Property changes on: trunk/myserver/include/log/stream/file_stream.h
___________________________________________________________________
Name: svn:mergeinfo
+
Added: trunk/myserver/include/log/stream/file_stream_creator.h
===================================================================
--- trunk/myserver/include/log/stream/file_stream_creator.h
(rev 0)
+++ trunk/myserver/include/log/stream/file_stream_creator.h 2008-09-22
20:20:14 UTC (rev 2834)
@@ -0,0 +1,34 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 FILE_STREAM_CREATOR_H
+#define FILE_STREAM_CREATOR_H
+
+#include <include/log/stream/log_stream_creator.h>
+#include <include/log/stream/file_stream.h>
+
+class FileStreamCreator : public LogStreamCreator
+{
+ public:
+ virtual LogStream* create (FiltersFactory* filtersFactory,
+ string& location,
+ list<string>& filters,
+ u_long cycleLog);
+};
+
+#endif
Added: trunk/myserver/include/log/stream/log_stream.h
===================================================================
--- trunk/myserver/include/log/stream/log_stream.h
(rev 0)
+++ trunk/myserver/include/log/stream/log_stream.h 2008-09-22 20:20:14 UTC
(rev 2834)
@@ -0,0 +1,189 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 LOG_STREAM_H
+#define LOG_STREAM_H
+
+#include <list>
+#include <string>
+
+#include <include/filter/filters_chain.h>
+#include <include/filter/filters_factory.h>
+#include <include/filter/stream.h>
+
+
+/*!
+ * Defines some events of interest for LogStream objects.
+ */
+enum LogStreamEvent
+{
+ EVT_SET_CYCLE_LOG,
+ EVT_LOG,
+ EVT_CLOSE,
+ EVT_ADD_FILTER
+};
+
+
+using namespace std;
+
+
+class LogStream
+{
+ public:
+
+
+ /*!
+ * The constructor.
+ * \param filtersFactory An instance of FiltersFactory.
+ * \param cycleLog The cycleLog value.
+ * \param outStream The Stream where this LogStream will
+ * write the log messages.
+ * \param filtersChain The messages will pass through a
+ * FiltersChain before being written to the Stream.
+ */
+ LogStream (FiltersFactory* filtersFactory,
+ u_long cycleLog,
+ Stream* outStream,
+ FiltersChain* filtersChain);
+
+
+ /*!
+ * \return 0 on success.
+ */
+ int addFilter (Filter* filter);
+
+
+ /*!
+ * \return 0 on success.
+ */
+ int removeFilter (Filter* filter);
+
+
+ /*!
+ * \return 0 on success.
+ */
+ int update (LogStreamEvent evt, void* message = 0, void* reply = 0);
+
+
+ /*!
+ * \return 0 on success.
+ */
+ int close ();
+
+
+ /*!
+ * \return 0 the close method was called.
+ */
+ int getIsOpened ();
+
+
+ u_long getLatestWrittenBytes ();
+
+
+ virtual u_long streamSize ();
+
+
+ u_long getCycleLog ();
+
+
+ Stream* getOutStream ();
+
+
+ FiltersFactory const* getFiltersFactory ();
+
+
+ FiltersChain* getFiltersChain ();
+
+
+ void setCycleLog (u_long cycleLog);
+
+
+ /*!
+ * Check if we have reached the max allowed size for the log.
+ * \return 0 if there is no need to cycle the log yet.
+ */
+ int needToCycle ();
+
+
+ /*!
+ * \return 0 on success.
+ */
+ virtual int log (string& message);
+
+
+ virtual ~LogStream ();
+
+ protected:
+
+
+ /*!
+ * \return 0 on success.
+ */
+ virtual int streamCycle ();
+
+
+ /*!
+ * Flushes any remaining data in the FiltersChain, cycle the stream
+ * and recreates all filters.
+ * \return 0 on success.
+ */
+ int doCycle ();
+
+
+ /*!
+ * \return 0 on success.
+ */
+ int write (string& message);
+
+
+ /*!
+ * \return 0 on success.
+ */
+ int resetFilters ();
+
+
+ /*!
+ * The latest number of bytes written to the Stream.
+ */
+ u_long nbw;
+
+
+ /*!
+ * Will be zero after a successful call to the close method.
+ */
+ int isOpened;
+
+
+ /*!
+ * A zero value means `never cycle'. A non-zero value establishes
+ * the maximum size allowed for the LogStream's growth before
+ * cycling it.
+ */
+ u_long cycleLog;
+
+
+ FiltersChain* filtersChain;
+
+
+ Stream* outStream;
+
+
+ FiltersFactory* filtersFactory;
+};
+
+#endif
Property changes on: trunk/myserver/include/log/stream/log_stream.h
___________________________________________________________________
Name: svn:mergeinfo
+
Added: trunk/myserver/include/log/stream/log_stream_creator.h
===================================================================
--- trunk/myserver/include/log/stream/log_stream_creator.h
(rev 0)
+++ trunk/myserver/include/log/stream/log_stream_creator.h 2008-09-22
20:20:14 UTC (rev 2834)
@@ -0,0 +1,37 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 LOG_STREAM_CREATOR_H
+#define LOG_STREAM_CREATOR_H
+
+#include <list>
+#include <string>
+
+#include <include/log/stream/log_stream.h>
+#include <include/filter/filters_factory.h>
+
+class LogStreamCreator
+{
+ public:
+ virtual LogStream* create (FiltersFactory* filtersFactory,
+ string& location,
+ list<string>& filters,
+ u_long cycleLog) = 0;
+};
+
+#endif
Added: trunk/myserver/include/log/stream/log_stream_factory.h
===================================================================
--- trunk/myserver/include/log/stream/log_stream_factory.h
(rev 0)
+++ trunk/myserver/include/log/stream/log_stream_factory.h 2008-09-22
20:20:14 UTC (rev 2834)
@@ -0,0 +1,100 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 LOG_STREAM_FACTORY_H
+#define LOG_STREAM_FACTORY_H
+
+#include <list>
+#include <map>
+#include <string>
+
+#include <include/log/stream/log_stream.h>
+#include <include/log/stream/console_stream_creator.h>
+#include <include/log/stream/file_stream_creator.h>
+#include <include/log/stream/socket_stream_creator.h>
+#include <include/log/stream/log_stream_creator.h>
+
+using namespace std;
+
+class LogStreamFactory
+{
+public:
+
+
+ /*!
+ * This constructor initializes the logStreamCreators map. To
+ * add more LogStreams, you have to create a new class implementing
+ * the LogStreamCreator interface and then add it here providing
+ * a valid protocol string (in the form protocol://) as key.
+ */
+ LogStreamFactory ();
+
+
+ /*!
+ * The destructor. Ensures that the memory allocated for
+ * all the LogStreamCreator objects gets freed.
+ */
+ ~LogStreamFactory ();
+
+
+ /*!
+ * Factory method. Creates a new concrete LogStream.
+ * \param filtersFactory Self explicating.
+ * \param location This is the path where the LogStream will point to.
+ * The location string must follow the syntax `protocol://path/to/log'.
+ * The protocol:// part can't be missing, since it is required to get
+ * the proper constructor for the new object that will be created.
+ * \param filters A list of strings representing filters to be used within
+ * the new LogStream.
+ * \param cycleLog Whether the log should be cycled or not. 0 means never
+ * cycle.
+ * \return A new instance of one of LogStream subclasses.
+ */
+ LogStream* createLogStream (FiltersFactory* filtersFactory,
+ string& location,
+ list<string>& filters,
+ u_long cycleLog);
+
+
+ /*!
+ * A helper method useful to get the protocol part of a location string.
+ * \param location The string representing a valid location as explained
+ * in createLogStream method description.
+ * \return A new string with the protocol part of the location.
+ */
+ string getProtocol (string& location);
+
+
+ /*!
+ * A helper method useful to get the path part of a location string.
+ * \param location The string representing a valid location as explained
+ * in createLogStream method description.
+ * \return A new string with the path part of the location.
+ */
+ string getPath (string& location);
+
+private:
+
+
+ /*!
+ * Holds all the constructors known by the LogStreamFactory.
+ */
+ map<string, LogStreamCreator*> logStreamCreators;
+};
+
+#endif
Property changes on: trunk/myserver/include/log/stream/log_stream_factory.h
___________________________________________________________________
Name: svn:mergeinfo
+
Added: trunk/myserver/include/log/stream/socket_stream.h
===================================================================
--- trunk/myserver/include/log/stream/socket_stream.h
(rev 0)
+++ trunk/myserver/include/log/stream/socket_stream.h 2008-09-22 20:20:14 UTC
(rev 2834)
@@ -0,0 +1,38 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 SOCKET_STREAM_H
+#define SOCKET_STREAM_H
+
+#include <list>
+#include <string>
+
+#include <include/base/socket/socket.h>
+#include <include/log/stream/log_stream.h>
+
+class SocketStream : public LogStream
+{
+ public:
+
+ SocketStream (FiltersFactory* filtersFactory,
+ u_long cycleLog,
+ Stream* outStream,
+ FiltersChain* filtersChain);
+};
+
+#endif
Added: trunk/myserver/include/log/stream/socket_stream_creator.h
===================================================================
--- trunk/myserver/include/log/stream/socket_stream_creator.h
(rev 0)
+++ trunk/myserver/include/log/stream/socket_stream_creator.h 2008-09-22
20:20:14 UTC (rev 2834)
@@ -0,0 +1,48 @@
+/* -*- mode: c++ -*- */
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 SOCKET_STREAM_CREATOR_H
+#define SOCKET_STREAM_CREATOR_H
+
+#include <include/log/stream/log_stream_creator.h>
+#include <include/log/stream/socket_stream.h>
+
+#include <stdlib.h>
+
+class SocketStreamCreator : public LogStreamCreator
+{
+ public:
+ virtual LogStream* create (FiltersFactory* filtersFactory,
+ string& location,
+ list<string>& filters,
+ u_long cycleLog);
+
+
+ /*!
+ * A helper method to get the port part of an URL.
+ */
+ u_short getPort (string& location);
+
+
+ /*!
+ * A helper method to get the host part of an URL.
+ */
+ string getHost (string& location);
+};
+
+#endif
Modified: trunk/myserver/src/filter/Makefile.am
===================================================================
--- trunk/myserver/src/filter/Makefile.am 2008-09-21 20:49:18 UTC (rev
2833)
+++ trunk/myserver/src/filter/Makefile.am 2008-09-22 20:20:14 UTC (rev
2834)
@@ -1,5 +1,6 @@
lib_LIBRARIES = libfilter.a
-libfilter_a_SOURCES = filter.cpp filters_chain.cpp filters_factory.cpp
memory_stream.cpp stream.cpp
+libfilter_a_SOURCES = filter.cpp filters_chain.cpp filters_factory.cpp
memory_stream.cpp stream.cpp \
+ console.cpp
SUBDIRS = gzip
INCLUDES = $(all_includes)
Added: trunk/myserver/src/filter/console.cpp
===================================================================
--- trunk/myserver/src/filter/console.cpp (rev 0)
+++ trunk/myserver/src/filter/console.cpp 2008-09-22 20:20:14 UTC (rev
2834)
@@ -0,0 +1,48 @@
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 <include/filter/console.h>
+
+Console::Console () : Stream ()
+{
+
+}
+
+Console::~Console ()
+{
+
+}
+
+int
+Console::flush (u_long* nbw)
+{
+ return *nbw = 0;
+}
+
+int
+Console::read (char* buffer, u_long len, u_long* nbr)
+{
+ return *nbr = 0;
+}
+
+int
+Console::write (const char* buffer, u_long len, u_long* nbw)
+{
+ cout << buffer;
+ *nbw = len;
+ return 0;
+}
Modified: trunk/myserver/src/filter/filters_chain.cpp
===================================================================
--- trunk/myserver/src/filter/filters_chain.cpp 2008-09-21 20:49:18 UTC (rev
2833)
+++ trunk/myserver/src/filter/filters_chain.cpp 2008-09-22 20:20:14 UTC (rev
2834)
@@ -355,3 +355,13 @@
}
}
+
+list<string>
+FiltersChain::getFilters ()
+{
+ list<Filter*>::iterator it;
+ list<string> filters;
+ for (it = this->filters.begin (); it != this->filters.end (); it++)
+ filters.push_back (string ((*it)->getName (0, 0)));
+ return filters;
+}
Modified: trunk/myserver/src/log/Makefile.am
===================================================================
--- trunk/myserver/src/log/Makefile.am 2008-09-21 20:49:18 UTC (rev 2833)
+++ trunk/myserver/src/log/Makefile.am 2008-09-22 20:20:14 UTC (rev 2834)
@@ -1,5 +1,4 @@
lib_LIBRARIES = liblog.a
liblog_a_SOURCES = log_manager.cpp
-SUBDIRS =
+SUBDIRS = stream
INCLUDES = $(all_includes)
-
Modified: trunk/myserver/src/log/log_manager.cpp
===================================================================
--- trunk/myserver/src/log/log_manager.cpp 2008-09-21 20:49:18 UTC (rev
2833)
+++ trunk/myserver/src/log/log_manager.cpp 2008-09-22 20:20:14 UTC (rev
2834)
@@ -1,6 +1,6 @@
/*
MyServer
-Copyright (C) 2002, 2003, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
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
@@ -15,451 +15,342 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
-#include "stdafx.h"
#include <include/log/log_manager.h>
-#include <include/base/utility.h>
-#include <include/filter/gzip/gzip.h>
-#include <include/base/file/files_utility.h>
-#include <string>
-#include <sstream>
-#include <iostream>
+int const LogManager::TYPE_CONSOLE = 1;
+int const LogManager::TYPE_FILE = 2;
-using namespace std;
+LogManager::LogManager (FiltersFactory* filtersFactory,
+ LogStreamFactory* logStreamFactory,
+ LoggingLevel level) : level (level)
+{
+ this->filtersFactory = filtersFactory;
+ this->logStreamFactory = logStreamFactory;
+ mutex = new Mutex ();
+ mutex->init ();
+}
-const int LogManager::TYPE_CONSOLE = 1;
-const int LogManager::TYPE_FILE = 2;
+LogManager::~LogManager ()
+{
+ if (!empty ())
+ clear ();
+ delete mutex;
+}
-/*!
- *Initialize the object.
- */
-LogManager::LogManager()
+void
+LogManager::addLogStream (string& location,
+ list<string>& filters,
+ u_long cycleLog)
{
- loaded = 0;
- /*!
- *By default put everything on the console.
- */
- type = TYPE_CONSOLE;
- gzipLog = 1;
- maxSize = 0;
- mutex.init();
- cycleLog = 0;
+ mutex->lock ();
+ if (!contains (location))
+ {
+ logStreams[location] =
+ logStreamFactory->createLogStream (filtersFactory,
+ location,
+ filters,
+ cycleLog);
+ }
+ mutex->unlock ();
}
-/*!
- *Destroy the object.
- */
-LogManager::~LogManager()
+void
+LogManager::removeLogStream (string& location)
{
- /*!
- *Try to close the file.
- */
- mutex.destroy();
- close();
+ mutex->lock ();
+ if (contains (location))
+ {
+ delete logStreams[location];
+ logStreams.erase (location);
+ }
+ mutex->unlock ();
}
-/*!
- *Load and use the file to save logs.
- *Return zero on sucess.
- */
-int LogManager::load(const char *filename)
+LogStream*
+LogManager::getLogStream (string& location)
{
- int opt, ret;
- /*!
- *If the file is still loaded close it before load again.
- */
- if(loaded)
- close();
+ if (contains (location))
+ return logStreams[location];
+ return 0;
+}
- opt = File::MYSERVER_OPEN_APPEND |
- File::MYSERVER_OPEN_ALWAYS |
- File::MYSERVER_OPEN_WRITE |
- File::MYSERVER_OPEN_READ |
- File::MYSERVER_NO_INHERIT;
+int
+LogManager::notifyLogStreams (LogStreamEvent evt,
+ void* message,
+ void* reply)
+{
+ mutex->lock ();
+ map<string, LogStream*>::iterator it;
+ int retVal = 0;
+ for (it = logStreams.begin (); it != logStreams.end (); it++)
+ {
+ retVal |= it->second->update (evt, message, reply);
+ }
+ mutex->unlock ();
+ return retVal;
+}
- ret = file.openFile(filename, opt);
+int
+LogManager::log (string& message, LoggingLevel level, string location)
+{
+ if (level >= this->level)
+ {
+ if (contains (location))
+ {
+ return logStreams[location]->log (message);
+ }
+ else
+ {
+ return notifyLogStreams (EVT_LOG, static_cast<void*>(&message));
+ }
+ }
+ return 1;
+}
- if(ret)
- {
- return 1;
- }
- setType(TYPE_FILE);
- loaded = 1;
- return 0;
-
+int
+LogManager::close (string location)
+{
+ if (contains (location))
+ {
+ return logStreams[location]->close ();
+ }
+ return notifyLogStreams (EVT_CLOSE);
}
-/*!
- *Close the file.
- */
-int LogManager::close()
+void
+LogManager::setCycleLog (u_long cycleLog, string location)
{
- if(loaded)
- file.close();
- return 0;
+ if (contains (location))
+ {
+ logStreams[location]->setCycleLog (cycleLog);
+ }
+ else
+ {
+ notifyLogStreams (EVT_SET_CYCLE_LOG, static_cast<void*>(&cycleLog));
+ }
}
-/*!
- *Set the type for the log.
- */
-void LogManager::setType(int nType)
+LoggingLevel
+LogManager::setLoggingLevel (LoggingLevel level)
{
- type = nType;
+ LoggingLevel oldLevel = level;
+ this->level = level;
+ return oldLevel;
}
-/*!
- *Set the max size for the log.
- *Returns the old limit.
- *Using a size of zero means that this limit is not used.
- */
-u_long LogManager::setMaxSize(u_long nMax)
+u_long
+LogManager::getCycleLog (string& location)
{
- u_long oldMax = maxSize;
- maxSize = nMax;
- return oldMax;
+ if (contains (location))
+ return logStreams[location]->getCycleLog ();
}
+LoggingLevel
+LogManager::getLoggingLevel ()
+{
+ return level;
+}
-/*!
- *Write the string to the log plus termination character[s].
- *Returns 0 on success.
- */
-int LogManager::writeln(const char *str)
+void
+LogManager::setLogStreamFactory (LogStreamFactory* logStreamFactory)
{
- int ret = write(str);
-#ifdef WIN32
- if(ret == 0)
- ret = write("\r\n");
-#else
- if(ret == 0)
- ret = write("\n");
-#endif
- return ret;
+ this->logStreamFactory = logStreamFactory;
}
-/*!
- *Set the log to save results on a new file when the max size is reached.
- */
-void LogManager::setCycleLog(int l)
+LogStreamFactory*
+LogManager::getLogStreamFactory ()
{
- cycleLog = l;
+ return logStreamFactory;
}
-/*!
- *Get if the log store log data on a new file when the max size is reached.
- */
-int LogManager::getCycleLog()
+void
+LogManager::setFiltersFactory (FiltersFactory* filtersFactory)
{
- return cycleLog;
+ this->filtersFactory = filtersFactory;
}
-/*!
- *Write the string to the log.
- *Returns 0 on success.
- */
-int LogManager::write(const char *str, int len)
+FiltersFactory*
+LogManager::getFiltersFactory ()
{
- int ret;
- if(type == TYPE_CONSOLE)
- {
- cout << str;
- }
- else if(type == TYPE_FILE)
- {
- u_long nbw;
+ return filtersFactory;
+}
- /*!
- *File was not loaded correctly.
- */
- if(!loaded)
- {
- return 1;
- }
+int
+LogManager::size ()
+{
+ return logStreams.size ();
+}
- /*!
- *We reached the max file size.
- *Don't use this limitation if maxSize is equal to zero.
- */
- if(maxSize && (file.getFileSize() > maxSize))
- {
- if(storeFile())
- return 1;
- }
+void
+LogManager::clear ()
+{
+ map<string, LogStream*>::iterator it;
+ for (it = logStreams.begin (); it != logStreams.end (); it++)
+ delete it->second;
+ logStreams.clear ();
+}
- /*!
- *If the len specified is equal to zero write the string as
- *a null character terminated one.
- */
- ret = file.writeToFile(str, len ? len : (u_long)strlen(str), &nbw);
- return ret;
- }
- return 0;
+bool
+LogManager::empty ()
+{
+ return size () == 0;
}
-/*!
- *Set if the log will cycle log files using gzip.
- */
-void LogManager::setGzip(bool useGzip)
+bool
+LogManager::contains (string& location)
{
- gzipLog = useGzip;
+ return logStreams.count (location) > 0;
}
-/*!
- *Returns nonzero if the log is using gzip for cycled logs.
+/*
+ * *******************************************************************
+ *
+ * D E P R E C A T E D
+ *
+ * *******************************************************************
*/
-int LogManager::getGzip()
+
+LogManager::LogManager () : level (WARNING)
{
- return gzipLog;
+ mutex = new Mutex ();
+ this->filtersFactory = new FiltersFactory ();
+ this->filtersFactory->insert ("gzip", Gzip::factory);
+ logStreamFactory = new LogStreamFactory ();
+ mutex->init ();
+ type = TYPE_CONSOLE;
+ maxSize = 0;
+ gzipLog = 1;
+ cycleLog = 0;
+ string location ("console://");
+ list<string> filters;
+ addLogStream (location, filters, maxSize);
}
-/*!
- *Store the log manager in another file and reload the file.
- */
-int LogManager::storeFile()
+int
+LogManager::load (const char *filename)
{
- char *buffer = 0;
- char *buffer2= 0;
- const u_long bufferSize = MYSERVER_KB(64);
- try
- {
- string filepath;
- string filedir;
- string filename;
- ostringstream newfilename;
- string time;
- Gzip gzip;
+ setType (TYPE_FILE);
+ clear ();
+ string location ("file://");
+ location.append (filename);
+ list<string> filters;
+ addLogStream (location, filters, maxSize);
+ return 0;
+}
- /*! Do nothing if we haven't to cycle log files. */
- if(!cycleLog)
- return 1;
+int
+LogManager::write (const char *str, int len)
+{
+ string message (str);
+ return notifyLogStreams (EVT_LOG, static_cast<void*>(&message));
+}
-#ifdef DO_NOT_USE_GZIP
- gzipLog = 0;
-#endif
+int LogManager::getLogSize ()
+{
+ if (getFile ())
+ return getFile ()->getFileSize ();
+ return 0;
+}
- filepath.assign(getFile()->getFilename());
- FilesUtility::completePath(filepath);
- FilesUtility::splitPath(filepath, filedir, filename);
+void
+LogManager::setCycleLog (u_long cycleLog)
+{
+ cycleLog = 1;
+ notifyLogStreams (EVT_SET_CYCLE_LOG, static_cast<void*>(&maxSize));
+}
- getRFC822LocalTime(time, 32);
- time = trim(time.substr(5,32));
-
- for(int i=0;i< static_cast<int>(time.length()); i++)
- if((time[i] == ' ') || (time[i] == ':'))
- time[i]= '.';
-
- newfilename << filedir << "/" << filename << "." << time;
-
- if(gzipLog)
- newfilename << ".gz";
-
+File*
+LogManager::getFile ()
+{
+ map<string, LogStream*>::iterator it;
+ for (it = logStreams.begin (); it != logStreams.end (); it++)
{
- char gzipData[16];
- File newFile;
- File *currentFile = getFile();
-
- buffer = new char[bufferSize];
- if(buffer == 0)
- return 1;
- buffer2 = new char[bufferSize];
- if(buffer == 0)
- {
- delete [] buffer;
- return 1;
- }
-
- if(newFile.openFile(newfilename.str().c_str(),
- File::MYSERVER_OPEN_WRITE | File::MYSERVER_NO_INHERIT |
File::MYSERVER_CREATE_ALWAYS ))
- {
- delete [] buffer;
- delete [] buffer2;
- return 1;
- }
- if(currentFile->setFilePointer(0))
- {
- delete [] buffer;
- delete [] buffer2;
- newFile.close();
- return 1;
- }
- if(gzipLog)
- {
- u_long nbw;
- u_long len = gzip.getHeader(gzipData, 16);
- if(newFile.writeToFile(gzipData, len, &nbw))
- {
- delete [] buffer;
- delete [] buffer2;
- newFile.close();
- return 1;
- }
- gzip.initialize();
- }
-
- for(;;)
- {
- u_long nbr;
- u_long nbw;
- if(currentFile->readFromFile(buffer,gzipLog ? bufferSize/2 :
bufferSize, &nbr))
- {
- delete [] buffer;
- delete [] buffer2;
- newFile.close();
- return 1;
- }
- if(nbr == 0)
- break;
- if(gzipLog)
- {
- u_long nbw;
- u_long size=gzip.compress(buffer,nbr, buffer2, bufferSize/2);
- if(newFile.writeToFile(buffer2, size, &nbw))
- {
- delete [] buffer;
- delete [] buffer2;
- newFile.close();
- return 1;
- }
- }
- else if(newFile.writeToFile(buffer, nbr, &nbw))
- {
- delete [] buffer;
- delete [] buffer2;
- newFile.close();
- return 1;
- }
- }
- if(gzipLog)
- {
- u_long nbw;
- u_long len = gzip.flush(buffer2, bufferSize/2);
- if(newFile.writeToFile(buffer2, len, &nbw))
- {
- delete [] buffer;
- delete [] buffer2;
- newFile.close();
- return 1;
- }
- len=gzip.getFooter(gzipData, 16);
- if(newFile.writeToFile(gzipData, len, &nbw))
- {
- delete [] buffer;
- delete [] buffer2;
- newFile.close();
- return 1;
- }
- gzip.free();
- }
- newFile.close();
- currentFile->close();
- FilesUtility::deleteFile(filepath.c_str());
- if(currentFile->openFile(filepath.c_str(), File::MYSERVER_OPEN_APPEND|
- File::MYSERVER_OPEN_ALWAYS |
File::MYSERVER_OPEN_WRITE |
- File::MYSERVER_OPEN_READ |
File::MYSERVER_NO_INHERIT))
- {
- delete [] buffer;
- delete [] buffer2;
- return 1;
- }
+ if (it->first.find ("file://") != string::npos)
+ {
+ return dynamic_cast<File*>(it->second->getOutStream ());
+ }
}
+ return 0;
+}
- delete [] buffer;
- delete [] buffer2;
- return 0;
- }
- catch(...)
- {
- if(buffer)
- delete [] buffer;
- if(buffer2)
- delete [] buffer2;
- throw;
- };
+int
+LogManager::writeln (const char *str)
+{
+ int ret = write (str);
+#ifdef WIN32
+ if (ret == 0)
+ ret = write ("\r\n");
+#else
+ if (ret == 0)
+ ret = write ("\n");
+#endif
+ return ret;
}
-/*!
- *Get the type of log.
- */
-int LogManager::getType()
+u_long LogManager::getMaxSize()
{
- return type;
+ return maxSize;
}
-/*!
- *Switch in the error output mode.
- */
-int LogManager::preparePrintError()
+u_long
+LogManager::setMaxSize (u_long nMax)
{
+ u_long old = maxSize;
+ maxSize = nMax;
+ setCycleLog (cycleLog);
+ return old;
+}
- if(type == TYPE_CONSOLE)
- {
- ::preparePrintError();
- }
+void
+LogManager::setGzip (int useGzip)
+{
+ gzipLog = useGzip;
+ if (gzipLog)
+ notifyLogStreams (EVT_ADD_FILTER, new Gzip ());
+}
- return 0;
+int
+LogManager::getType ()
+{
+ return type;
}
-/*!
- *Exit from printing errors.
- */
-int LogManager::endPrintError()
+void
+LogManager::setType (int nType)
{
- if(type == TYPE_CONSOLE)
- {
- ::endPrintError();
- }
- return 0;
+ type = nType;
}
-/*!
- *Get a pointer to the file object.
- */
-File *LogManager::getFile()
+int
+LogManager::preparePrintError ()
{
- return &file;
+ return 0;
}
-/*!
- *Request access for the thread.
- */
-int LogManager::requestAccess()
+int
+LogManager::endPrintError ()
{
- mutex.lock();
return 0;
}
-/*!
- *Terminate the access for the thread.
- */
-int LogManager::terminateAccess()
+int LogManager::requestAccess ()
{
- mutex.unlock();
return 0;
}
-/*!
- *Return the max size for the log.
- */
-u_long LogManager::getMaxSize()
+int LogManager::terminateAccess ()
{
- return maxSize;
+ return 0;
}
-/*!
- *Return the actual size for the log file.
- */
-int LogManager::getLogSize()
+int
+LogManager::getGzip ()
{
- switch(type)
- {
- case TYPE_FILE:
- return file.getFileSize();
+ return gzipLog;
+}
- case TYPE_CONSOLE:
- return 0;
- }
-
+int
+LogManager::storeFile()
+{
return 0;
-
}
Added: trunk/myserver/src/log/stream/Makefile.am
===================================================================
--- trunk/myserver/src/log/stream/Makefile.am (rev 0)
+++ trunk/myserver/src/log/stream/Makefile.am 2008-09-22 20:20:14 UTC (rev
2834)
@@ -0,0 +1,8 @@
+lib_LIBRARIES = libstream.a
+libstream_a_SOURCES = console_stream.cpp file_stream.cpp \
+ log_stream.cpp log_stream_factory.cpp \
+ log_stream_creator.cpp file_stream_creator.cpp \
+ console_stream_creator.cpp socket_stream.cpp \
+ socket_stream_creator.cpp
+SUBDIRS =
+INCLUDE = $(all_includes)
Added: trunk/myserver/src/log/stream/console_stream.cpp
===================================================================
--- trunk/myserver/src/log/stream/console_stream.cpp
(rev 0)
+++ trunk/myserver/src/log/stream/console_stream.cpp 2008-09-22 20:20:14 UTC
(rev 2834)
@@ -0,0 +1,29 @@
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 <include/log/stream/console_stream.h>
+
+ConsoleStream::ConsoleStream (FiltersFactory* filtersFactory,
+ u_long cycleLog,
+ Stream* outStream,
+ FiltersChain* filtersChain) :
+LogStream (filtersFactory,
+ cycleLog,
+ outStream,
+ filtersChain)
+{
+}
Added: trunk/myserver/src/log/stream/console_stream_creator.cpp
===================================================================
--- trunk/myserver/src/log/stream/console_stream_creator.cpp
(rev 0)
+++ trunk/myserver/src/log/stream/console_stream_creator.cpp 2008-09-22
20:20:14 UTC (rev 2834)
@@ -0,0 +1,35 @@
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 <include/log/stream/console_stream_creator.h>
+
+LogStream*
+ConsoleStreamCreator::create (FiltersFactory* filtersFactory,
+ string& location,
+ list<string>& filters,
+ u_long cycleLog)
+{
+ Console* outStream = new Console ();
+ u_long nbw;
+ FiltersChain* filtersChain = filtersFactory->chain (filters,
+ outStream,
+ &nbw);
+ return new ConsoleStream (filtersFactory,
+ cycleLog,
+ outStream,
+ filtersChain);
+}
Added: trunk/myserver/src/log/stream/file_stream.cpp
===================================================================
--- trunk/myserver/src/log/stream/file_stream.cpp
(rev 0)
+++ trunk/myserver/src/log/stream/file_stream.cpp 2008-09-22 20:20:14 UTC
(rev 2834)
@@ -0,0 +1,145 @@
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 <include/log/stream/file_stream.h>
+
+int const FileStream::defaultFileMask = File::MYSERVER_OPEN_APPEND |
+ File::MYSERVER_OPEN_ALWAYS |
+ File::MYSERVER_OPEN_WRITE |
+ File::MYSERVER_OPEN_READ |
+ File::MYSERVER_NO_INHERIT;
+
+FileStream::FileStream (FiltersFactory* filtersFactory,
+ u_long cycleLog,
+ Stream* outStream,
+ FiltersChain* filtersChain) :
+ LogStream (filtersFactory, cycleLog, outStream, filtersChain)
+{
+}
+
+u_long
+FileStream::streamSize ()
+{
+ return dynamic_cast<File*>(outStream)->getFileSize ();
+}
+
+int
+FileStream::streamCycle ()
+{
+ char *buffer = 0;
+ char *buffer2 = 0;
+ const u_long bufferSize = MYSERVER_KB (64);
+ try
+ {
+ string filepath;
+ string filedir;
+ string filename;
+ string ext;
+ ostringstream newfilename;
+ string time;
+
+ filepath.assign (dynamic_cast<File*>(outStream)->getFilename ());
+ FilesUtility::completePath (filepath);
+ FilesUtility::splitPath (filepath, filedir, filename);
+
+ FilesUtility::getFileExt (ext, filename);
+
+ getRFC822LocalTime (time, 32);
+ time = trim (time.substr (5, 32));
+
+ for (int i = 0; i < static_cast<int>(time.length ()); i++)
+ if ((time[i] == ' ') || (time[i] == ':'))
+ time[i]= '.';
+ if (ext.size ())
+ {
+ filename = (filename.substr (0, filename.find (string (".") + ext)));
+ }
+ newfilename << filedir << "/" << filename << "." << time <<
+ (ext.size () ? "." : "") << ext;
+
+ File newFile;
+ File *currentFile = dynamic_cast<File*>(outStream);
+
+ buffer = new char[bufferSize];
+ if (buffer == 0)
+ return 1;
+ buffer2 = new char[bufferSize];
+ if (buffer == 0)
+ {
+ delete [] buffer;
+ return 1;
+ }
+
+ if (newFile.openFile (newfilename.str ().c_str (),
+ File::MYSERVER_OPEN_WRITE |
+ File::MYSERVER_NO_INHERIT |
+ File::MYSERVER_CREATE_ALWAYS))
+ {
+ delete [] buffer;
+ delete [] buffer2;
+ return 1;
+ }
+ if (currentFile->setFilePointer (0))
+ {
+ delete [] buffer;
+ delete [] buffer2;
+ newFile.close ();
+ return 1;
+ }
+ for (;;)
+ {
+ u_long nbr;
+ u_long nbw;
+ if(currentFile->readFromFile (buffer, bufferSize, &nbr))
+ {
+ delete [] buffer;
+ delete [] buffer2;
+ newFile.close ();
+ return 1;
+ }
+ if (nbr == 0)
+ break;
+ if (newFile.writeToFile (buffer, nbr, &nbw))
+ {
+ delete [] buffer;
+ delete [] buffer2;
+ newFile.close ();
+ return 1;
+ }
+ }
+ newFile.close ();
+ currentFile->close ();
+ FilesUtility::deleteFile (filepath.c_str ());
+ if (currentFile->openFile (filepath.c_str(), defaultFileMask))
+ {
+ delete [] buffer;
+ delete [] buffer2;
+ return 1;
+ }
+ delete [] buffer;
+ delete [] buffer2;
+ return 0;
+ }
+ catch (...)
+ {
+ if (buffer)
+ delete [] buffer;
+ if (buffer2)
+ delete [] buffer2;
+ throw;
+ };
+}
Added: trunk/myserver/src/log/stream/file_stream_creator.cpp
===================================================================
--- trunk/myserver/src/log/stream/file_stream_creator.cpp
(rev 0)
+++ trunk/myserver/src/log/stream/file_stream_creator.cpp 2008-09-22
20:20:14 UTC (rev 2834)
@@ -0,0 +1,36 @@
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 <include/log/stream/file_stream_creator.h>
+
+LogStream*
+FileStreamCreator::create (FiltersFactory* filtersFactory,
+ string& location,
+ list<string>& filters,
+ u_long cycleLog)
+{
+ Stream* outStream = new File (const_cast<char*>(location.c_str ()),
+ FileStream::defaultFileMask);
+ u_long nbw;
+ FiltersChain* filtersChain = filtersFactory->chain (filters,
+ outStream,
+ &nbw);
+ return new FileStream (filtersFactory,
+ cycleLog,
+ outStream,
+ filtersChain);
+}
Added: trunk/myserver/src/log/stream/log_stream.cpp
===================================================================
--- trunk/myserver/src/log/stream/log_stream.cpp
(rev 0)
+++ trunk/myserver/src/log/stream/log_stream.cpp 2008-09-22 20:20:14 UTC
(rev 2834)
@@ -0,0 +1,177 @@
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 <include/log/stream/log_stream.h>
+
+LogStream::LogStream (FiltersFactory* filtersFactory,
+ u_long cycleLog,
+ Stream* outStream,
+ FiltersChain* filtersChain) :
+cycleLog (cycleLog), isOpened (1)
+{
+ this->filtersFactory = filtersFactory;
+ this->outStream = outStream;
+ this->filtersChain = filtersChain;
+}
+
+LogStream::~LogStream ()
+{
+ if (isOpened)
+ close ();
+ filtersChain->clearAllFilters ();
+ delete outStream;
+ delete filtersChain;
+}
+
+int
+LogStream::resetFilters ()
+{
+ list<string> filters (filtersChain->getFilters ());
+ filtersChain->clearAllFilters ();
+ return filtersFactory->chain (filtersChain, filters, outStream, &nbw);
+}
+
+int
+LogStream::log (string& message)
+{
+ if (needToCycle ())
+ {
+ return doCycle () || write (message);
+ }
+ return write (message);
+}
+
+int
+LogStream::needToCycle ()
+{
+ return cycleLog && (streamSize () >= cycleLog);
+}
+
+int
+LogStream::doCycle ()
+{
+ return filtersChain->flush (&nbw) || streamCycle () || resetFilters ();
+}
+
+int
+LogStream::write (string& message)
+{
+ return filtersChain->write (message.c_str (), message.size (), &nbw);
+}
+
+void
+LogStream::setCycleLog (u_long cycleLog)
+{
+ this->cycleLog = cycleLog;
+}
+
+u_long
+LogStream::getCycleLog ()
+{
+ return cycleLog;
+}
+
+Stream*
+LogStream::getOutStream ()
+{
+ return outStream;
+}
+
+FiltersChain*
+LogStream::getFiltersChain ()
+{
+ return filtersChain;
+}
+
+int
+LogStream::close ()
+{
+ return isOpened = (filtersChain->flush (&nbw) || outStream->close ());
+}
+
+int
+LogStream::update (LogStreamEvent evt, void* message, void* reply)
+{
+ switch (evt)
+ {
+ case EVT_SET_CYCLE_LOG:
+ {
+ setCycleLog (*static_cast<u_long*>(message));
+ return 0;
+ }
+ break;
+ case EVT_LOG:
+ {
+ return log (*static_cast<string*>(message));
+ }
+ break;
+ case EVT_CLOSE:
+ {
+ return close ();
+ }
+ break;
+ case EVT_ADD_FILTER:
+ {
+ return addFilter (static_cast<Filter*>(message));
+ }
+ break;
+ default:
+ return 1;
+ }
+}
+
+int
+LogStream::addFilter (Filter* filter)
+{
+ return filtersChain->addFilter (filter, &nbw);
+}
+
+int
+LogStream::removeFilter (Filter* filter)
+{
+ return filtersChain->removeFilter (filter);
+}
+
+FiltersFactory const*
+LogStream::getFiltersFactory ()
+{
+ return filtersFactory;
+}
+
+u_long
+LogStream::streamSize ()
+{
+ return 0;
+}
+
+int
+LogStream::streamCycle ()
+{
+ return 0;
+}
+
+int
+LogStream::getIsOpened ()
+{
+ return isOpened;
+}
+
+u_long
+LogStream::getLatestWrittenBytes ()
+{
+ return nbw;
+}
Added: trunk/myserver/src/log/stream/log_stream_creator.cpp
===================================================================
--- trunk/myserver/src/log/stream/log_stream_creator.cpp
(rev 0)
+++ trunk/myserver/src/log/stream/log_stream_creator.cpp 2008-09-22
20:20:14 UTC (rev 2834)
@@ -0,0 +1,18 @@
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 <include/log/stream/log_stream_creator.h>
Added: trunk/myserver/src/log/stream/log_stream_factory.cpp
===================================================================
--- trunk/myserver/src/log/stream/log_stream_factory.cpp
(rev 0)
+++ trunk/myserver/src/log/stream/log_stream_factory.cpp 2008-09-22
20:20:14 UTC (rev 2834)
@@ -0,0 +1,61 @@
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 <include/log/stream/log_stream_factory.h>
+
+LogStreamFactory::LogStreamFactory ()
+{
+ logStreamCreators["file://"] = new FileStreamCreator ();
+ logStreamCreators["console://"] = new ConsoleStreamCreator ();
+ logStreamCreators["socket://"] = new SocketStreamCreator ();
+}
+
+LogStreamFactory::~LogStreamFactory ()
+{
+ map<string, LogStreamCreator*>::iterator it;
+ for (it = logStreamCreators.begin ();
+ it != logStreamCreators.end (); it++)
+ {
+ delete it->second;
+ }
+}
+
+LogStream*
+LogStreamFactory::createLogStream (FiltersFactory* filtersFactory,
+ string& location,
+ list<string>& filters,
+ u_long cycleLog)
+{
+ string protocol (getProtocol (location));
+ string path (getPath (location));
+ return logStreamCreators[protocol]->create (filtersFactory,
+ path,
+ filters,
+ cycleLog);
+}
+
+string
+LogStreamFactory::getProtocol (string& location)
+{
+ return (location.substr (0, location.find("://"))).append ("://");
+}
+
+string
+LogStreamFactory::getPath (string& location)
+{
+ return location.substr (getProtocol (location).size (), location.size ());
+}
Added: trunk/myserver/src/log/stream/socket_stream.cpp
===================================================================
--- trunk/myserver/src/log/stream/socket_stream.cpp
(rev 0)
+++ trunk/myserver/src/log/stream/socket_stream.cpp 2008-09-22 20:20:14 UTC
(rev 2834)
@@ -0,0 +1,29 @@
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 <include/log/stream/socket_stream.h>
+
+SocketStream::SocketStream (FiltersFactory* filtersFactory,
+ u_long cycleLog,
+ Stream* outStream,
+ FiltersChain* filtersChain) :
+LogStream (filtersFactory,
+ cycleLog,
+ outStream,
+ filtersChain)
+{
+}
Property changes on: trunk/myserver/src/log/stream/socket_stream.cpp
___________________________________________________________________
Name: svn:mergeinfo
+
Added: trunk/myserver/src/log/stream/socket_stream_creator.cpp
===================================================================
--- trunk/myserver/src/log/stream/socket_stream_creator.cpp
(rev 0)
+++ trunk/myserver/src/log/stream/socket_stream_creator.cpp 2008-09-22
20:20:14 UTC (rev 2834)
@@ -0,0 +1,49 @@
+/*
+MyServer
+Copyright (C) 2006, 2008 Free Software Foundation, Inc.
+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 <include/log/stream/socket_stream_creator.h>
+
+LogStream*
+SocketStreamCreator::create (FiltersFactory* filtersFactory,
+ string& location,
+ list<string>& filters,
+ u_long cycleLog)
+{
+ Stream* outStream = new Socket ();
+ u_long nbw;
+ dynamic_cast<Socket*>(outStream)->connect (getHost (location).c_str (),
+ getPort (location));
+ FiltersChain* filtersChain = filtersFactory->chain (filters,
+ outStream,
+ &nbw);
+ return new SocketStream (filtersFactory,
+ cycleLog,
+ outStream,
+ filtersChain);
+}
+
+u_short
+SocketStreamCreator::getPort (string& location)
+{
+ return static_cast<u_short>(atoi (location.substr (location.find (":") +
1).c_str ()));
+}
+
+string
+SocketStreamCreator::getHost (string& location)
+{
+ return location.substr (0, location.find (":"));
+}
Property changes on: trunk/myserver/src/log/stream/socket_stream_creator.cpp
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: trunk/myserver/tests/Makefile.am
===================================================================
--- trunk/myserver/tests/Makefile.am 2008-09-21 20:49:18 UTC (rev 2833)
+++ trunk/myserver/tests/Makefile.am 2008-09-22 20:20:14 UTC (rev 2834)
@@ -2,5 +2,5 @@
#
bin_PROGRAMS = tests_suite
-tests_suite_SOURCES = main.cpp test_base64.cpp test_cached_file.cpp
test_cached_file_buffer.cpp test_cached_file_factory.cpp test_connection.cpp
test_connections_scheduler.cpp test_files_utility.cpp test_filter_chain.cpp
test_ftp.cpp test_gzip.cpp test_hashmap.cpp test_homedir.cpp
test_http_request.cpp test_http_response.cpp test_md5.cpp test_mem_buff.cpp
test_mem_stream.cpp test_multicast.cpp test_mutex.cpp test_recursive_mutex.cpp
test_regex.cpp test_pipe.cpp test_safetime.cpp test_semaphore.cpp
test_thread.cpp test_utility.cpp
+tests_suite_SOURCES = main.cpp test_base64.cpp test_cached_file.cpp
test_cached_file_buffer.cpp test_cached_file_factory.cpp test_connection.cpp
test_connections_scheduler.cpp test_files_utility.cpp test_filter_chain.cpp
test_ftp.cpp test_gzip.cpp test_hashmap.cpp test_homedir.cpp
test_http_request.cpp test_http_response.cpp test_md5.cpp test_mem_buff.cpp
test_mem_stream.cpp test_multicast.cpp test_mutex.cpp test_recursive_mutex.cpp
test_regex.cpp test_pipe.cpp test_safetime.cpp test_semaphore.cpp
test_thread.cpp test_utility.cpp test_log_manager.cpp
tests_suite_LDADD = ../src/libmyserver.a $(CPPUNIT_LDFLAGS) $(PTHREAD_LIB)
$(IDN_LIB) $(XNET_LIB) $(EVENT_LIB) $(DL_LIB) $(OPENSSL_LIB) $(ZLIB_LIB)
$(XML_LIBS) $(LDFLAGS)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [myserver-commit] [2834] Added the new LogManager.,
Francesco Pipita <=