ITK  6.0.0
Insight Toolkit
itkLoggerManager.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef itkLoggerManager_h
19#define itkLoggerManager_h
20
21#include "itkObject.h"
22#include "itkObjectFactory.h"
23#include "itkThreadLogger.h"
24
25#include <string>
26#include <map>
27
28namespace itk
29{
42class ITKCommon_EXPORT LoggerManager : public Object
43{
44public:
49
51 itkOverrideGetNameOfClassMacro(LoggerManager);
52
54 itkNewMacro(Self);
55
57
59
62
63 using NameType = std::string;
64
67 CreateLogger(const NameType & name,
70
76
78 void
79 AddLogger(const NameType & name, Logger * logger);
80
81 Logger *
82 GetLogger(const NameType & name);
83
84 void
86
87 void
89
90 void
92
93 void
94 Write(PriorityLevelEnum level, std::string const & content);
95
96 void
98
99protected:
101 LoggerManager() = default;
102
104 ~LoggerManager() override = default;
105
107 void
108 PrintSelf(std::ostream & os, Indent indent) const override;
109
110private:
111 std::map<NameType, LoggerPointer> m_LoggerSet{};
112}; // class Logger
113} // namespace itk
114
115#endif // itkLoggerManager_h
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Represents an output stream.
Definition: itkLogOutput.h:40
LoggerBaseEnums::PriorityLevel PriorityLevelEnum
Definition: itkLoggerBase.h:94
MultipleLogOutput::OutputType OutputType
Definition: itkLoggerBase.h:92
Used for centrally managing loggers.
void PrintSelf(std::ostream &os, Indent indent) const override
ThreadLoggerPointer CreateThreadLogger(const NameType &name, PriorityLevelEnum level, PriorityLevelEnum levelForFlushing=LoggerBase::PriorityLevelEnum::MUSTFLUSH)
~LoggerManager() override=default
void SetPriorityLevel(PriorityLevelEnum level)
LoggerPointer CreateLogger(const NameType &name, PriorityLevelEnum level, PriorityLevelEnum levelForFlushing=LoggerBase::PriorityLevelEnum::MUSTFLUSH)
void Write(PriorityLevelEnum level, std::string const &content)
void AddLogOutput(OutputType *output)
LoggerManager()=default
Logger * GetLogger(const NameType &name)
void SetLevelForFlushing(PriorityLevelEnum level)
void AddLogger(const NameType &name, Logger *logger)
Used for logging information during a run.
Definition: itkLogger.h:37
SmartPointer< Self > Pointer
Definition: itkLogger.h:43
Base class for most ITK classes.
Definition: itkObject.h:62
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....