![]() |
ITK
4.1.0
Insight Segmentation and Registration Toolkit
|
00001 /*========================================================================= 00002 * 00003 * Copyright Insight Software Consortium 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0.txt 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 * 00017 *=========================================================================*/ 00018 #ifndef __itkLoggerManager_h 00019 #define __itkLoggerManager_h 00020 00021 #include "itkObject.h" 00022 #include "itkObjectFactory.h" 00023 #include "itkThreadLogger.h" 00024 00025 #include <string> 00026 #include <map> 00027 00028 namespace itk 00029 { 00042 class ITKCommon_EXPORT LoggerManager:public Object 00043 { 00044 public: 00045 00046 typedef LoggerManager Self; 00047 typedef Object Superclass; 00048 typedef SmartPointer< Self > Pointer; 00049 typedef SmartPointer< const Self > ConstPointer; 00050 00052 itkTypeMacro(LoggerManager, Object); 00053 00055 itkNewMacro(Self); 00056 00057 typedef Logger::PriorityLevelType PriorityLevelType; 00058 00059 typedef Logger::OutputType OutputType; 00060 00061 typedef Logger::Pointer LoggerPointer; 00062 typedef ThreadLogger::Pointer ThreadLoggerPointer; 00063 00064 typedef std::string NameType; 00065 00067 LoggerPointer CreateLogger( 00068 const NameType & name, 00069 PriorityLevelType level, 00070 PriorityLevelType levelForFlushing = LoggerBase::MUSTFLUSH); 00071 00073 ThreadLoggerPointer CreateThreadLogger( 00074 const NameType & name, 00075 PriorityLevelType level, 00076 PriorityLevelType levelForFlushing = LoggerBase::MUSTFLUSH); 00077 00079 void AddLogger(const NameType & name, Logger *logger); 00080 00081 Logger * GetLogger(const NameType & name); 00082 00083 void SetPriorityLevel(PriorityLevelType level); 00084 00085 void SetLevelForFlushing(PriorityLevelType level); 00086 00087 void AddLogOutput(OutputType *output); 00088 00089 void Write(PriorityLevelType level, std::string const & content); 00090 00091 void Flush(); 00092 00093 protected: 00094 00096 LoggerManager() {} 00097 00099 virtual ~LoggerManager() {} 00100 00102 void PrintSelf(std::ostream & s, Indent indent) const; 00103 00104 private: 00105 00106 typedef std::map< NameType, LoggerPointer > ContainerType; 00107 00108 ContainerType m_LoggerSet; 00109 }; // class Logger 00110 } // namespace itk 00111 00112 #endif // __itkLoggerManager_h 00113