Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkLogger.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkLogger.h,v $
00005   Language:  C++
00006   Date:      $Date: 2005/05/26 20:13:46 $
00007   Version:   $Revision: 1.4 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 
00018 #ifndef __itkLogger_h
00019 #define __itkLogger_h
00020 
00021 #if defined(_MSC_VER)
00022    //Warning about: identifier was truncated to '255' characters in the debug information (MVC6.0 Debug)
00023    #pragma warning( disable : 4786 )
00024   // warning C4503: 'insert' : decorated name length exceeded, name was truncated
00025   #pragma warning ( disable : 4503 )
00026 #endif
00027 
00028 #include "itkMacro.h"
00029 #include "itkObject.h"
00030 #include "itkObjectFactory.h"
00031 #include "itkMultipleLogOutput.h"
00032 #include "itkRealTimeClock.h"
00033 
00034 namespace itk
00035 {
00046 class ITKCommon_EXPORT Logger : public Object
00047 {
00048 
00049 public:
00050   
00051   typedef Logger  Self;
00052   typedef Object  Superclass;
00053   typedef SmartPointer<Self>  Pointer;
00054   typedef SmartPointer<const Self>  ConstPointer;
00055 
00057   itkTypeMacro( Logger, Object );
00058 
00060   itkNewMacro( Self );
00061 
00062   typedef  MultipleLogOutput::OutputType   OutputType;
00063 
00066   typedef enum 
00067   { 
00068     MUSTFLUSH=0,
00069     FATAL,
00070     CRITICAL,
00071     WARNING,
00072     INFO,
00073     DEBUG,
00074     NOTSET
00075   } PriorityLevelType;
00076 
00077   itkSetStringMacro(Name);
00078 
00079   itkGetStringMacro(Name);
00080 
00084   virtual void SetPriorityLevel( PriorityLevelType level )
00085   {
00086     m_PriorityLevel = level;
00087   }
00088 
00092   virtual PriorityLevelType GetPriorityLevel() const
00093   {
00094     return m_PriorityLevel;
00095   }
00096 
00097   virtual void SetLevelForFlushing( PriorityLevelType level )
00098   {
00099     m_LevelForFlushing = level;
00100   }
00101 
00102   virtual PriorityLevelType GetLevelForFlushing() const
00103   {
00104     return m_LevelForFlushing;
00105   }
00106 
00108   virtual void AddLogOutput( OutputType* output );
00109 
00110   virtual void Write(PriorityLevelType level, std::string const & content);
00111 
00112   virtual void Flush();
00113 
00114 protected:
00115 
00117   Logger();
00118 
00120   virtual ~Logger();
00121 
00123   virtual void PrintSelf(std::ostream &os, Indent indent) const;
00124 
00125 protected:
00126 
00127   PriorityLevelType m_PriorityLevel;
00128 
00129   PriorityLevelType m_LevelForFlushing;
00130 
00131   MultipleLogOutput::Pointer  m_Output;
00132 
00133 private:
00134 
00135   RealTimeClock::Pointer  m_Clock;
00136 
00137   std::string m_Name;
00138 
00139 };  // class Logger
00140 
00141 
00142 } // namespace itk
00143 
00144 
00145 #endif  // __itkLogger_h

Generated at Tue Aug 30 16:45:10 2005 for ITK by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2000