OpenMS
Loading...
Searching...
No Matches
LogConfigHandler.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Timo Sachsenberg$
6// $Authors: Stephan Aiche$
7// --------------------------------------------------------------------------
8
9#pragma once
10
13
16
17namespace OpenMS
18{
19
26 class OPENMS_DLLAPI LogConfigHandler
27 {
28public:
29
30 static std::string PARAM_NAME;
31
56 Param parse(const StringList & setting);
57
82 void configure(const Param & param);
83
91 std::ostream & getStream(const std::string & stream_name);
92
107 void setLogLevel(const std::string & log_level);
108
113
116
117protected:
118
128 Logger::LogStream & getLogStreamByName_(const std::string & stream_name);
129
137 std::set<std::string> & getConfigSetByName_(const std::string & stream_type);
138
148 StreamHandler::StreamType getStreamTypeByName_(const std::string & stream_type);
149
150 std::set<std::string> debug_streams_;
151 std::set<std::string> info_streams_;
152 std::set<std::string> warn_streams_;
153 std::set<std::string> error_streams_;
154 std::set<std::string> fatal_streams_;
155
156 std::map<std::string, StreamHandler::StreamType> stream_type_map_;
157
158private:
159 friend OPENMS_DLLAPI std::ostream & operator<<(std::ostream & os, LogConfigHandler const & lch);
160
161 // the pointer to the single instance
163
164 // it is a singleton so we hide all c' and d'tors
165
168
171
173 virtual LogConfigHandler & operator=(const LogConfigHandler & source);
174 };
175
177 OPENMS_DLLAPI std::ostream & operator<<(std::ostream & os, LogConfigHandler const & lch);
178
179} // end namespace OpenMS
180
The LogConfigHandler provides the functionality to configure the internal logging of OpenMS algorithm...
Definition LogConfigHandler.h:27
static LogConfigHandler * instance_
Definition LogConfigHandler.h:162
std::set< std::string > & getConfigSetByName_(const std::string &stream_type)
Returns the correct set of registered streams for the given stream type (e.g. DEBUG,...
StreamHandler::StreamType getStreamTypeByName_(const std::string &stream_type)
Translates the given stream_type std::string into a valid StreamHandler::StreamType.
std::set< std::string > warn_streams_
List of all streams that were appended to OpenMS::getGlobalLogWarn()
Definition LogConfigHandler.h:152
LogConfigHandler()
Default constructor.
LogConfigHandler(const LogConfigHandler &source)
Copy constructor.
virtual LogConfigHandler & operator=(const LogConfigHandler &source)
Assignment operator.
static LogConfigHandler * getInstance()
Returns the instance of LogConfigHandler.
virtual ~LogConfigHandler()
Destructor.
static std::string PARAM_NAME
Name of the parameter in which the configuration should be stored.
Definition LogConfigHandler.h:30
std::set< std::string > debug_streams_
List of all streams that were appended to OpenMS::getGlobalLogDebug()
Definition LogConfigHandler.h:150
void setLogLevel(const std::string &log_level)
Sets a minimum log_level by removing all streams from loggers lower than that level,...
friend std::ostream & operator<<(std::ostream &os, LogConfigHandler const &lch)
Overload for the insertion operator (operator<<) to have a formatted output of the LogConfigHandler.
std::ostream & getStream(const std::string &stream_name)
Returns a reference to the registered stream with the name stream_name.
Logger::LogStream & getLogStreamByName_(const std::string &stream_name)
Returns the named global instance of the LogStream. (OpenMS::getGlobalLogDebug(), OpenMS::getGlobalLo...
std::map< std::string, StreamHandler::StreamType > stream_type_map_
Maps the registered streams to a StreamHandler::StreamType.
Definition LogConfigHandler.h:156
Param parse(const StringList &setting)
Translates the given list of parameter settings into a LogStream configuration.
std::set< std::string > fatal_streams_
List of all streams that were appended to OpenMS::getGlobalLogFatal()
Definition LogConfigHandler.h:154
void configure(const Param &param)
Applies the given parameters (param) to the current configuration.
std::set< std::string > info_streams_
List of all streams that were appended to OpenMS::getGlobalLogInfo()
Definition LogConfigHandler.h:151
std::set< std::string > error_streams_
List of all streams that were appended to OpenMS::getGlobalLogError()
Definition LogConfigHandler.h:153
Log Stream Class.
Definition LogStream.h:341
Management and storage of parameters / INI files.
Definition Param.h:46
StreamType
Defines the type of the stream that should be handled.
Definition StreamHandler.h:49
std::vector< std::string > StringList
Vector of String.
Definition ListUtils.h:44
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
std::ostream & operator<<(std::ostream &os, const AccurateMassSearchResult &amsr)