mirror of
https://github.com/g4klx/DMRGateway
synced 2025-12-23 06:45:39 +08:00
Add DMR Master logging-in to the JSON status messages.
This commit is contained in:
11
Log.cpp
11
Log.cpp
@@ -18,6 +18,7 @@
|
||||
|
||||
#include "Log.h"
|
||||
#include "MQTTConnection.h"
|
||||
#include "Utils.h"
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#include <Windows.h>
|
||||
@@ -94,6 +95,16 @@ void Log(unsigned int level, const char* fmt, ...)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void WriteJSONStatus(const std::string& status)
|
||||
{
|
||||
nlohmann::json json;
|
||||
|
||||
json["timestamp"] = CUtils::createTimestamp();
|
||||
json["message"] = status;
|
||||
|
||||
WriteJSON("status", json);
|
||||
}
|
||||
|
||||
void WriteJSON(const std::string& topLevel, nlohmann::json& json)
|
||||
{
|
||||
if (m_mqtt != NULL) {
|
||||
|
||||
Reference in New Issue
Block a user