GstPipelineStudio/src/Logger.h
Stéphane Cerveau 11ab47ffde Introduce logger class
GraphManager is now using pipeviz category
Logger class is able to read GST logs.
Ony WARN and ERROR are logged now.
2017-06-20 22:51:49 +02:00

46 lines
760 B
C++

/*
* Logger.h
*
* Created on: 31 mai 2017
* Author: scerveau
*/
#ifndef LOGGER_H_
#define LOGGER_H_
#include <QThread>
#include "glib.h"
enum eLogCategory {
eLOG_CATEGORY_INTERNAL,
eLOG_CATEGORY_GST,
eLOG_CATEGORY_EVENTS,
};
#define LOG_INFO(x) Logger::instance().processLog(x)
class Logger : public QThread {
Q_OBJECT
public:
Logger();
void configure_logger();
static Logger& instance();
void Quit();
void processLog(const QString& line);
protected:
void processGstLog(gchar* line);
gchar* readGstLine(FILE *file);
GList* parseGstLine(gchar* line, gchar ch = ' ', int max_field = -1);
signals:
void sendLog(const QString& message, int category);
private:
void run();
bool m_fExit;
};
#endif /* LOGGER_H_ */