203 char * pbuf_ =
nullptr;
458 void setPrefix(
const std::ostream & s,
const std::string & prefix);
517 : log_stream_(log_stream), stream_(stream)
519 log_stream_.remove(stream_);
525 log_stream_.insert(stream_);
575#define OPENMS_LOG_FATAL_ERROR \
576 OpenMS::getThreadLocalLogFatal() << __FILE__ << "(" << __LINE__ << "): "
579#define OPENMS_LOG_ERROR \
580 OpenMS::getThreadLocalLogError()
583#define OPENMS_LOG_WARN \
584 OpenMS::getThreadLocalLogWarn()
587#define OPENMS_LOG_INFO \
588 OpenMS::getThreadLocalLogInfo()
591#define OPENMS_LOG_DEBUG \
592 OpenMS::getThreadLocalLogDebug() << past_last_slash(__FILE__) << "(" << __LINE__ << "): "
595#define OPENMS_LOG_DEBUG_NOFILE \
596 OpenMS::getThreadLocalLogDebug()
Color and style the fonts shown on cout/cerr (or other streams)
Definition Colorizer.h:71
RAII guard that temporarily removes a stream from a LogStream and re-inserts it on scope exit.
Definition LogStream.h:508
LogSinkGuard(LogSinkGuard &&)=delete
LogSinkGuard(const LogSinkGuard &)=delete
LogSinkGuard & operator=(const LogSinkGuard &)=delete
LogSinkGuard(LogStream &log_stream, std::ostream &stream)
Construct a guard that removes the stream and re-inserts it on destruction.
Definition LogStream.h:516
LogSinkGuard & operator=(LogSinkGuard &&)=delete
~LogSinkGuard()
Destructor re-inserts the stream.
Definition LogStream.h:523
LogStream & log_stream_
Definition LogStream.h:535
std::ostream & stream_
Definition LogStream.h:536
Stream buffer used by LogStream.
Definition LogStream.h:80
Size getNextLogCounter_()
Returns the next free index for a log message.
std::map< Size, std::string > log_time_cache_
Cache of the occurrence sequence of the last two log messages.
Definition LogStream.h:229
std::string expandPrefix_(const std::string &prefix, time_t time) const
Interpret the prefix format string and return the expanded prefix.
LogStreamBuf(LogStreamBuf *source_buf, Colorizer *col=nullptr)
std::string level_
Definition LogStream.h:204
std::list< StreamStruct > stream_list_
Stream list for this buffer.
Definition LogStream.h:205
int counter
Definition LogStream.h:217
Size timestamp
Definition LogStream.h:216
const std::list< StreamStruct > & getStreamList_() const
std::map< std::string, LogCacheStruct > log_cache_
Cache of the last two log messages.
Definition LogStream.h:227
LogStreamBuf(const std::string &log_level=UNKNOWN_LOG_LEVEL, Colorizer *col=nullptr)
int syncLF_()
Non-lock acquiring sync function called in the d'tor.
void setLevel(std::string level)
std::string addToCache_(std::string const &line)
std::string incomplete_line_
Definition LogStream.h:206
void distribute_(const std::string &outstring)
Distribute a new message to connected streams.
std::list< StreamStruct > & getStreamList_()
Returns the stream list (owned or shared)
static const std::string UNKNOWN_LOG_LEVEL
Definition LogStream.h:89
bool isInCache_(std::string const &line)
Checks if the line is already in the cache.
static const time_t MAX_TIME
Definition LogStream.h:88
int overflow(int c=-1) override
Holds a counter of occurrences and an index for the occurrence sequence of the corresponding log mess...
Definition LogStream.h:215
Sink-side hook that is notified whenever a LogStream flushes a complete message.
Definition LogStream.h:267
void unregister()
Detach from the currently registered LogStream, if any.
virtual ~LogStreamNotifier()
Destructor; calls unregister so the LogStream stops dispatching to this notifier.
virtual void logNotify()
Hook called by the registered LogStream after each complete message has been flushed.
LogStreamNotifier()
Construct a detached notifier; registered_at_ starts at nullptr.
LogStream * registered_at_
The LogStream this notifier is currently attached to, or nullptr if detached. Managed by registerAt /...
Definition LogStream.h:306
void registerAt(LogStream &log_stream)
Attach this notifier to log_stream so its logNotify is invoked after every flushed message.
std::stringstream stream_
Buffer that receives the formatted log line from the registered LogStream; read inside logNotify.
Definition LogStream.h:304
Log Stream Class.
Definition LogStream.h:341
bool hasStream_(std::ostream &stream)
LogStream(LogStreamBuf *buf=nullptr, bool delete_buf=true, std::ostream *stream=nullptr)
void insert(std::ostream &s)
std::list< LogStreamBuf::StreamStruct >::iterator StreamIterator
Definition LogStream.h:477
~LogStream() override
Clears all message buffers.
LogStreamBuf * operator->()
Arrow operator.
void setPrefix(const std::ostream &s, const std::string &prefix)
bool delete_buffer_
Definition LogStream.h:487
void insertNotification(std::ostream &s, LogStreamNotifier &target)
Add a notification target.
void setPrefix(const std::string &prefix)
Set prefix of all output streams, details see setPrefix method with ostream.
void setLevel(std::string level)
void remove(std::ostream &s)
StreamIterator findStream_(const std::ostream &stream)
void flushIncomplete()
Flush any incomplete line (text not terminated by newline) to all streams.
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition Types.h:97
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19
Logger::LogStream & getGlobalLogDebug()
Get the global debug log stream for configuration purposes.
Logger::LogStream & getThreadLocalLogDebug()
Get thread-local debug log stream.
Logger::LogStream & getGlobalLogError()
Get the global error log stream for configuration purposes.
Logger::LogStream & getThreadLocalLogInfo()
Get thread-local info log stream.
Logger::LogStream & getThreadLocalLogWarn()
Get thread-local warning log stream.
Logger::LogStream & getGlobalLogFatal()
Get the global fatal error log stream for configuration purposes.
Logger::LogStream & getThreadLocalLogFatal()
Get thread-local fatal error log stream.
Logger::LogStream & getGlobalLogWarn()
Get the global warning log stream for configuration purposes.
Logger::LogStream & getThreadLocalLogError()
Get thread-local error log stream.
Logger::LogStream & getGlobalLogInfo()
Get the global info log stream for configuration purposes.
Holds a stream that is connected to the LogStream. It also includes the minimum and maximum level at ...
Definition LogStream.h:168
std::string prefix
Definition LogStream.h:170
StreamStruct()
Definition LogStream.h:173
LogStreamNotifier * target
Definition LogStream.h:171
~StreamStruct()
Delete the notification target.
Definition LogStream.h:179
std::ostream * stream
Definition LogStream.h:169