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

itkLoggerBase.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkLoggerBase.h,v $
00005   Language:  C++
00006   Date:      $Date: 2005/11/05 03:49:12 $
00007   Version:   $Revision: 1.1 $
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 __itkLoggerBase_h
00019 #define __itkLoggerBase_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 LoggerBase : public Object
00047 {
00048 
00049 public:
00050 
00051   typedef LoggerBase  Self;
00052   typedef Object  Superclass;
00053   typedef SmartPointer<Self>  Pointer;
00054   typedef SmartPointer<const Self>  ConstPointer;
00055 
00057   itkTypeMacro( LoggerBase, Object );
00058 
00059   typedef  MultipleLogOutput::OutputType   OutputType;
00060 
00063   typedef enum
00064   {
00065     MUSTFLUSH=0,
00066     FATAL,
00067     CRITICAL,
00068     WARNING,
00069     INFO,
00070     DEBUG,
00071     NOTSET
00072   } PriorityLevelType;
00073 
00074   itkSetStringMacro(Name);
00075   itkGetStringMacro(Name);
00076 
00078   virtual std::string BuildFormattedEntry(PriorityLevelType level, std::string const & content);
00079 
00083   virtual void SetPriorityLevel( PriorityLevelType level )
00084   {
00085     m_PriorityLevel = level;
00086   }
00087 
00091   virtual PriorityLevelType GetPriorityLevel() const
00092   {
00093     return m_PriorityLevel;
00094   }
00095 
00096   virtual void SetLevelForFlushing( PriorityLevelType level )
00097   {
00098     m_LevelForFlushing = level;
00099   }
00100 
00101   virtual PriorityLevelType GetLevelForFlushing() const
00102   {
00103     return m_LevelForFlushing;
00104   }
00105 
00107   virtual void AddLogOutput( OutputType* output ) ;
00108 
00109 
00110   virtual void Write(PriorityLevelType level, std::string const & content) ;
00111   virtual void Flush();
00112 
00113 protected:
00114 
00116   LoggerBase();
00117 
00119   virtual ~LoggerBase();
00120 
00122   virtual void PrintSelf(std::ostream &os, Indent indent) const;
00123 
00124 protected:
00125 
00126   PriorityLevelType m_PriorityLevel;
00127 
00128   PriorityLevelType m_LevelForFlushing;
00129 
00130   MultipleLogOutput::Pointer  m_Output;
00131 
00132   RealTimeClock::Pointer  m_Clock;
00133 private:
00134 
00135   std::string m_Name;
00136 
00137 };  // class LoggerBase
00138 
00139 
00140 } // namespace itk
00141 
00142 
00143 #endif  // __itkLoggerBase_h

Generated at Wed May 24 23:37:01 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000