mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Logging enhancement / fixes (#1419)
* Instance in logging output * Fix: Trigger that previous log lines are shown in the Log UI
This commit is contained in:
@@ -256,7 +256,7 @@ public slots:
|
||||
/// @brief Get a pointer to the priorityMuxer instance
|
||||
/// @return PriorityMuxer instance pointer
|
||||
///
|
||||
PriorityMuxer* getMuxerInstance() { return &_muxer; }
|
||||
PriorityMuxer* getMuxerInstance() { return _muxer; }
|
||||
|
||||
///
|
||||
/// @brief enable/disable automatic/priorized source selection
|
||||
@@ -340,7 +340,7 @@ public slots:
|
||||
/// @brief Get the component Register
|
||||
/// return Component register pointer
|
||||
///
|
||||
ComponentRegister & getComponentRegister() { return _componentRegister; }
|
||||
ComponentRegister* getComponentRegister() { return _componentRegister; }
|
||||
|
||||
///
|
||||
/// @brief Called from components to update their current state. DO NOT CALL FROM USERS
|
||||
@@ -511,7 +511,7 @@ private:
|
||||
SettingsManager* _settingsManager;
|
||||
|
||||
/// Register that holds component states
|
||||
ComponentRegister _componentRegister;
|
||||
ComponentRegister* _componentRegister;
|
||||
|
||||
/// The specifiation of the led frame construction and picture integration
|
||||
LedString _ledString;
|
||||
@@ -522,7 +522,7 @@ private:
|
||||
std::vector<ColorOrder> _ledStringColorOrder;
|
||||
|
||||
/// The priority muxer
|
||||
PriorityMuxer _muxer;
|
||||
PriorityMuxer* _muxer;
|
||||
|
||||
/// The adjustment from raw colors to led colors
|
||||
MultiColorAdjustment * _raw2ledAdjustment;
|
||||
|
@@ -152,6 +152,13 @@ public:
|
||||
///
|
||||
static void printLedValues(const std::vector<ColorRgb>& ledValues);
|
||||
|
||||
///
|
||||
/// @brief Set the common logger for LED-devices.
|
||||
///
|
||||
/// @param[in] log The logger to be used
|
||||
///
|
||||
void setLogger(Logger* log) { _log = log; }
|
||||
|
||||
public slots:
|
||||
|
||||
///
|
||||
|
@@ -54,8 +54,8 @@ public:
|
||||
|
||||
struct T_LOG_MESSAGE
|
||||
{
|
||||
QString appName;
|
||||
QString loggerName;
|
||||
QString loggerSubName;
|
||||
QString function;
|
||||
unsigned int line;
|
||||
QString fileName;
|
||||
@@ -65,22 +65,22 @@ public:
|
||||
QString levelString;
|
||||
};
|
||||
|
||||
static Logger* getInstance(const QString & name = "", LogLevel minLevel=Logger::INFO);
|
||||
static void deleteInstance(const QString & name = "");
|
||||
static void setLogLevel(LogLevel level, const QString & name = "");
|
||||
static LogLevel getLogLevel(const QString & name = "");
|
||||
static Logger* getInstance(const QString & name = "", const QString & subName = "__", LogLevel minLevel=Logger::INFO);
|
||||
static void deleteInstance(const QString & name = "", const QString & subName = "__");
|
||||
static void setLogLevel(LogLevel level, const QString & name = "", const QString & subName = "__");
|
||||
static LogLevel getLogLevel(const QString & name = "", const QString & subName = "__");
|
||||
|
||||
void Message(LogLevel level, const char* sourceFile, const char* func, unsigned int line, const char* fmt, ...);
|
||||
void setMinLevel(LogLevel level) { _minLevel = static_cast<int>(level); }
|
||||
LogLevel getMinLevel() const { return static_cast<LogLevel>(int(_minLevel)); }
|
||||
QString getName() const { return _name; }
|
||||
QString getAppName() const { return _appname; }
|
||||
QString getSubName() const { return _subname; }
|
||||
|
||||
signals:
|
||||
void newLogMessage(Logger::T_LOG_MESSAGE);
|
||||
|
||||
protected:
|
||||
Logger(const QString & name="", LogLevel minLevel = INFO);
|
||||
Logger(const QString & name="", const QString & subName = "__", LogLevel minLevel = INFO);
|
||||
~Logger() override;
|
||||
|
||||
private:
|
||||
@@ -95,12 +95,12 @@ private:
|
||||
static QAtomicInteger<int> GLOBAL_MIN_LOG_LEVEL;
|
||||
|
||||
const QString _name;
|
||||
const QString _appname;
|
||||
const QString _subname;
|
||||
const bool _syslogEnabled;
|
||||
const unsigned _loggerId;
|
||||
|
||||
/* Only non-const member, hence the atomic */
|
||||
QAtomicInteger<int> _minLevel;
|
||||
QAtomicInteger<int> _minLevel;
|
||||
};
|
||||
|
||||
class LoggerManager : public QObject
|
||||
|
@@ -44,12 +44,12 @@ namespace hyperion {
|
||||
}
|
||||
};
|
||||
hyperion->setColor(PriorityMuxer::FG_PRIORITY, fg_color, fg_duration_ms);
|
||||
Info(Logger::getInstance("HYPERION"),"Initial foreground color set (%d %d %d)",fg_color.at(0).red,fg_color.at(0).green,fg_color.at(0).blue);
|
||||
Info(Logger::getInstance("HYPERION","I"+QString::number(hyperion->getInstanceIndex())),"Initial foreground color set (%d %d %d)",fg_color.at(0).red,fg_color.at(0).green,fg_color.at(0).blue);
|
||||
}
|
||||
else
|
||||
{
|
||||
int result = hyperion->setEffect(fgEffectConfig, PriorityMuxer::FG_PRIORITY, fg_duration_ms);
|
||||
Info(Logger::getInstance("HYPERION"),"Initial foreground effect '%s' %s", QSTRING_CSTR(fgEffectConfig), ((result == 0) ? "started" : "failed"));
|
||||
Info(Logger::getInstance("HYPERION","I"+QString::number(hyperion->getInstanceIndex())),"Initial foreground effect '%s' %s", QSTRING_CSTR(fgEffectConfig), ((result == 0) ? "started" : "failed"));
|
||||
}
|
||||
}
|
||||
#undef FGCONFIG_ARRAY
|
||||
|
Reference in New Issue
Block a user