Files
Sourcetrail/src/lib/utility/logging/LogManagerImplementation.h
T
Andreas Stallinger f53f6dae98 ui: logview logic in controller
* logfilter in applicationsettings
* logview limit 500 entries
2016-11-25 15:16:07 +01:00

60 lines
1.5 KiB
C++

#ifndef LOG_MANAGER_IMPLEMENTATION_H
#define LOG_MANAGER_IMPLEMENTATION_H
#include <algorithm>
#include <memory>
#include <mutex>
#include <vector>
#include "utility/logging/Logger.h"
class LogManagerImplementation
{
public:
LogManagerImplementation();
// Must be implemented because std::mutex is non-copyable, see
// http://stackoverflow.com/questions/14263836/why-does-stdmutex-create-a-c2248-when-used-in-a-struct-with-windows-socket
// for more details
LogManagerImplementation(const LogManagerImplementation& other);
void operator=(const LogManagerImplementation& other);
~LogManagerImplementation();
void addLogger(std::shared_ptr<Logger> logger);
void removeLogger(std::shared_ptr<Logger> logger);
void removeLoggersByType(const std::string& type);
void clearLoggers();
int getLoggerCount() const;
Logger* getLogger(std::shared_ptr<Logger> logger);
Logger* getLoggerByType(const std::string& type);
void logInfo(
const std::string& message,
const std::string& file,
const std::string& function,
const unsigned int line
);
void logWarning(
const std::string& message,
const std::string& file,
const std::string& function,
const unsigned int line
);
void logError(
const std::string& message,
const std::string& file,
const std::string& function,
const unsigned int line
);
private:
tm getTime();
std::vector<std::shared_ptr<Logger> > m_loggers;
mutable std::mutex m_loggerMutex;
};
#endif // LOG_MANAGER_IMPLEMENTATION_H