Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

LogOutputters.h

00001 /*
00002  * synergy -- mouse and keyboard sharing utility
00003  * Copyright (C) 2002 Chris Schoeneman
00004  * 
00005  * This package is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * found in the file COPYING that should have accompanied this file.
00008  * 
00009  * This package is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  */
00014 
00015 #ifndef LOGOUTPUTTERS_H
00016 #define LOGOUTPUTTERS_H
00017 
00018 #include "BasicTypes.h"
00019 #include "ILogOutputter.h"
00020 #include "CString.h"
00021 #include "stddeque.h"
00022 
00024 
00029 class CStopLogOutputter : public ILogOutputter {
00030 public:
00031     CStopLogOutputter();
00032     virtual ~CStopLogOutputter();
00033 
00034     // ILogOutputter overrides
00035     virtual void        open(const char* title);
00036     virtual void        close();
00037     virtual void        show(bool showIfEmpty);
00038     virtual bool        write(ELevel level, const char* message);
00039     virtual const char* getNewline() const;
00040 };
00041 
00043 
00047 class CConsoleLogOutputter : public ILogOutputter {
00048 public:
00049     CConsoleLogOutputter();
00050     virtual ~CConsoleLogOutputter();
00051 
00052     // ILogOutputter overrides
00053     virtual void        open(const char* title);
00054     virtual void        close();
00055     virtual void        show(bool showIfEmpty);
00056     virtual bool        write(ELevel level, const char* message);
00057     virtual const char* getNewline() const;
00058 };
00059 
00061 
00066 class CFileLogOutputter : public ILogOutputter {
00067 public:
00068     CFileLogOutputter();
00069     virtual ~CFileLogOutputter();
00070 
00071     // ILogOutputter overrides
00072     virtual void        open(const char* title);
00073     virtual void        close();
00074     virtual void        show(bool showIfEmpty);
00075     virtual bool        write(ELevel level, const char* message);
00076     virtual const char* getNewline() const;
00077 };
00078 
00080 
00083 class CSystemLogOutputter : public ILogOutputter {
00084 public:
00085     CSystemLogOutputter();
00086     virtual ~CSystemLogOutputter();
00087 
00088     // ILogOutputter overrides
00089     virtual void        open(const char* title);
00090     virtual void        close();
00091     virtual void        show(bool showIfEmpty);
00092     virtual bool        write(ELevel level, const char* message);
00093     virtual const char* getNewline() const;
00094 };
00095 
00097 
00104 class CSystemLogger {
00105 public:
00106     CSystemLogger(const char* title, bool blockConsole);
00107     ~CSystemLogger();
00108 
00109 private:
00110     ILogOutputter*      m_syslog;
00111     ILogOutputter*      m_stop;
00112 };
00113 
00115 
00118 class CBufferedLogOutputter : public ILogOutputter {
00119 private:
00120     typedef std::deque<CString> CBuffer;
00121 
00122 public:
00123     typedef CBuffer::const_iterator const_iterator;
00124 
00125     CBufferedLogOutputter(UInt32 maxBufferSize);
00126     virtual ~CBufferedLogOutputter();
00127 
00129 
00130 
00132     const_iterator      begin() const;
00133 
00135     const_iterator      end() const;
00136 
00138 
00139     // ILogOutputter overrides
00140     virtual void        open(const char* title);
00141     virtual void        close();
00142     virtual void        show(bool showIfEmpty);
00143     virtual bool        write(ELevel level, const char* message);
00144     virtual const char* getNewline() const;
00145 
00146 private:
00147     UInt32              m_maxBufferSize;
00148     CBuffer             m_buffer;
00149 };
00150 
00151 #endif

Generated on Fri Nov 6 00:21:15 2009 for synergy-plus by  doxygen 1.3.9.1