Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

PhxLog.h

Go to the documentation of this file.
00001 #ifndef PHX_LOG_H
00002 #define PHX_LOG_H
00003 
00011 #include <iostream>
00012 #include <Phx/Util/PhxPtrInterface.h>
00013 #include <Phx/Core/PhxNamedInterface.h>
00014 
00015 // Macros
00016 #define DEBUGGING LOG_LEVEL_DEBUG,__FILE__,__LINE__
00017 #define INFO LOG_LEVEL_INFO,__FILE__,__LINE__
00018 #define WARNING LOG_LEVEL_WARNING,__FILE__,__LINE__
00019 #define ERROR LOG_LEVEL_ERROR,__FILE__,__LINE__
00020 #define NORMAL LOG_LEVEL_NORMAL,__FILE__,__LINE__
00021 
00022 #define LOG_TO_STDOUT true
00023 
00024 namespace Phx
00025 {
00031   using namespace std;
00032 
00038   enum Mode
00039   { LOG_LEVEL_DEBUG, LOG_LEVEL_INFO, LOG_LEVEL_WARNING,
00040     LOG_LEVEL_ERROR, LOG_LEVEL_NORMAL
00041   };
00042 
00047   class Log:public NamedInterface
00048   {
00049   public:
00050     class OutputStream;
00051 
00052     static const NamedInterface::Type INTERFACE_TYPE;
00053     static const String INTERFACE_TYPE_NAME;
00054 
00055     static const NamedInterface::Identifier LOG_IDENTIFIER;
00056     static const String LOG_NAME;
00057 
00064     virtual Ptr < OutputStream >
00065     newOutputStream (const String & prefix) = 0;
00066   };
00067 
00068   class Log::OutputStream:public LockedPtrInterface < OutputStream >
00069   {
00070   public:
00071 
00072     virtual Log::OutputStream & stream (Mode mode,
00073                                         const char *file,
00074                                         int line) = 0;
00075 
00080     virtual Log::
00081     OutputStream & operator << (ostream &
00082                                 (*pf) (ostream &)) = 0;
00083 
00087     template < class T >
00088     Log::OutputStream & operator << (const T & str)
00089     {
00090       buffer () << str;
00091       return *this;
00092     }
00093   private:
00097     virtual ostream & buffer (void) = 0;
00098   };
00099 }
00100 #endif // PHX_LOG_H

Generated on Wed Dec 21 22:05:37 2005 for Phoenix OSFS by  doxygen 1.4.2