Commit 3741b025 authored by Pavel Vainerman's avatar Pavel Vainerman

Небольшие правки логов

parent 2648d598
...@@ -39,6 +39,8 @@ Version 2.3 ...@@ -39,6 +39,8 @@ Version 2.3
uniset-codegen: добавить ключ --gen-sensor-name для генерирования name_Item.. (чтобы можно было в логах использовать текстовые названия) uniset-codegen: добавить ключ --gen-sensor-name для генерирования name_Item.. (чтобы можно было в логах использовать текстовые названия)
uniset-codegen: перенести инициализацию полей в header (c++11) и "разгрузить конструкторы" uniset-codegen: перенести инициализацию полей в header (c++11) и "разгрузить конструкторы"
- Сделать диапазонные пороги в IOBase и SM (т.е. "1" когда min >= val <= max ).
SQL: SQL:
==== ====
- добавить работу с History (при передаче указателя на SM в конструкторе). - добавить работу с History (при передаче указателя на SM в конструкторе).
...@@ -51,6 +53,8 @@ HTTP API: ...@@ -51,6 +53,8 @@ HTTP API:
- запрос о том, кто последний сохранил указанный датчик - запрос о том, кто последний сохранил указанный датчик
- список объектов возвращать с их типом (чтобы можно было SM вычислять) - список объектов возвращать с их типом (чтобы можно было SM вычислять)
= Сделать возможность настраивать параметры httpserver-а из командной строки (количество потоков и т.п.) = Сделать возможность настраивать параметры httpserver-а из командной строки (количество потоков и т.п.)
- ТЕСТЫ (как вариант поизучать про тестовые фреймворки на питоне)
Version 2.5 Version 2.5
============ ============
......
...@@ -255,10 +255,12 @@ ...@@ -255,10 +255,12 @@
std::string help() noexcept; std::string help() noexcept;
<xsl:if test="normalize-space($DISABLE_REST_API)!='1'"> <xsl:if test="normalize-space($DISABLE_REST_API)!='1'">
#ifndef DISABLE_REST_API
// HTTP API // HTTP API
virtual nlohmann::json httpGet( const Poco::URI::QueryParameters&amp; p ) override; virtual nlohmann::json httpGet( const Poco::URI::QueryParameters&amp; p ) override;
virtual nlohmann::json httpRequest( const std::string&amp; req, const Poco::URI::QueryParameters&amp; p ) override; virtual nlohmann::json httpRequest( const std::string&amp; req, const Poco::URI::QueryParameters&amp; p ) override;
virtual nlohmann::json httpHelp( const Poco::URI::QueryParameters&amp; p ) override; virtual nlohmann::json httpHelp( const Poco::URI::QueryParameters&amp; p ) override;
#endif
</xsl:if> </xsl:if>
</xsl:template> </xsl:template>
...@@ -273,9 +275,11 @@ ...@@ -273,9 +275,11 @@
virtual bool activateObject() override; virtual bool activateObject() override;
virtual std::string getMonitInfo(){ return ""; } /*!&lt; пользовательская информация выводимая в getInfo() */ virtual std::string getMonitInfo(){ return ""; } /*!&lt; пользовательская информация выводимая в getInfo() */
<xsl:if test="normalize-space($DISABLE_REST_API)!='1'"> <xsl:if test="normalize-space($DISABLE_REST_API)!='1'">
#ifndef DISABLE_REST_API
virtual void httpGetUserData( nlohmann::json&amp; jdata ){} /*!&lt; для пользовательских данных в httpGet() */ virtual void httpGetUserData( nlohmann::json&amp; jdata ){} /*!&lt; для пользовательских данных в httpGet() */
virtual nlohmann::json httpDumpIO(); virtual nlohmann::json httpDumpIO();
virtual nlohmann::json httpRequestLog( const Poco::URI::QueryParameters&amp; p ); virtual nlohmann::json httpRequestLog( const Poco::URI::QueryParameters&amp; p );
#endif
</xsl:if> </xsl:if>
// Выполнение очередного шага программы // Выполнение очередного шага программы
virtual void step(){} virtual void step(){}
...@@ -565,6 +569,7 @@ uniset::SimpleInfo* <xsl:value-of select="$CLASSNAME"/>_SK::getInfo( CORBA::Long ...@@ -565,6 +569,7 @@ uniset::SimpleInfo* <xsl:value-of select="$CLASSNAME"/>_SK::getInfo( CORBA::Long
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
<xsl:if test="normalize-space($DISABLE_REST_API)!='1'"> <xsl:if test="normalize-space($DISABLE_REST_API)!='1'">
#ifndef DISABLE_REST_API
nlohmann::json <xsl:value-of select="$CLASSNAME"/>_SK::httpGet( const Poco::URI::QueryParameters&amp; params ) nlohmann::json <xsl:value-of select="$CLASSNAME"/>_SK::httpGet( const Poco::URI::QueryParameters&amp; params )
{ {
<xsl:if test="not(normalize-space($BASECLASS)='')">nlohmann::json json = <xsl:value-of select="$BASECLASS"/>::httpGet(params);</xsl:if> <xsl:if test="not(normalize-space($BASECLASS)='')">nlohmann::json json = <xsl:value-of select="$BASECLASS"/>::httpGet(params);</xsl:if>
...@@ -648,13 +653,11 @@ nlohmann::json <xsl:value-of select="$CLASSNAME"/>_SK::httpRequest( const std::s ...@@ -648,13 +653,11 @@ nlohmann::json <xsl:value-of select="$CLASSNAME"/>_SK::httpRequest( const std::s
nlohmann::json <xsl:value-of select="$CLASSNAME"/>_SK::httpRequestLog( const Poco::URI::QueryParameters&amp; p ) nlohmann::json <xsl:value-of select="$CLASSNAME"/>_SK::httpRequestLog( const Poco::URI::QueryParameters&amp; p )
{ {
nlohmann::json jret; nlohmann::json jret;
auto&amp; jdata = jret[myname]; jret[myname]["log"] = Debug::str(mylog->level());
jdata["log"] = Debug::str(mylog->level());
return std::move(jret); return std::move(jret);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#endif
</xsl:if> </xsl:if>
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
<xsl:if test="normalize-space($TESTMODE)!=''"> <xsl:if test="normalize-space($TESTMODE)!=''">
...@@ -1408,6 +1411,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::testMode( bool _state ) ...@@ -1408,6 +1411,7 @@ void <xsl:value-of select="$CLASSNAME"/>_SK::testMode( bool _state )
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
<xsl:if test="normalize-space($DISABLE_REST_API)!='1'"> <xsl:if test="normalize-space($DISABLE_REST_API)!='1'">
#ifndef DISABLE_REST_API
nlohmann::json <xsl:value-of select="$CLASSNAME"/>_SK::httpDumpIO() nlohmann::json <xsl:value-of select="$CLASSNAME"/>_SK::httpDumpIO()
{ {
nlohmann::json jdata; nlohmann::json jdata;
...@@ -1440,6 +1444,7 @@ nlohmann::json <xsl:value-of select="$CLASSNAME"/>_SK::httpDumpIO() ...@@ -1440,6 +1444,7 @@ nlohmann::json <xsl:value-of select="$CLASSNAME"/>_SK::httpDumpIO()
return std::move(jdata); return std::move(jdata);
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#endif
</xsl:if> </xsl:if>
std::string <xsl:value-of select="$CLASSNAME"/>_SK::dumpIO() std::string <xsl:value-of select="$CLASSNAME"/>_SK::dumpIO()
...@@ -1794,6 +1799,7 @@ bool <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( uniset::ObjectId _code, boo ...@@ -1794,6 +1799,7 @@ bool <xsl:value-of select="$CLASSNAME"/>_SK::setMsg( uniset::ObjectId _code, boo
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
<xsl:if test="normalize-space($DISABLE_REST_API)!='1'"> <xsl:if test="normalize-space($DISABLE_REST_API)!='1'">
#ifndef DISABLE_REST_API
nlohmann::json <xsl:value-of select="$CLASSNAME"/>_SK::httpDumpIO() nlohmann::json <xsl:value-of select="$CLASSNAME"/>_SK::httpDumpIO()
{ {
nlohmann::json jdata; nlohmann::json jdata;
...@@ -1825,6 +1831,7 @@ nlohmann::json <xsl:value-of select="$CLASSNAME"/>_SK::httpDumpIO() ...@@ -1825,6 +1831,7 @@ nlohmann::json <xsl:value-of select="$CLASSNAME"/>_SK::httpDumpIO()
return std::move(jdata); return std::move(jdata);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#endif
</xsl:if> </xsl:if>
std::string <xsl:value-of select="$CLASSNAME"/>_SK::dumpIO() std::string <xsl:value-of select="$CLASSNAME"/>_SK::dumpIO()
......
...@@ -40,6 +40,7 @@ void UHttpRequestHandler::handleRequest( Poco::Net::HTTPServerRequest& req, Poco ...@@ -40,6 +40,7 @@ void UHttpRequestHandler::handleRequest( Poco::Net::HTTPServerRequest& req, Poco
nlohmann::json jdata; nlohmann::json jdata;
jdata["error"] = resp.getReasonForStatus(resp.getStatus()); jdata["error"] = resp.getReasonForStatus(resp.getStatus());
jdata["ecode"] = resp.getStatus(); jdata["ecode"] = resp.getStatus();
jdata["message"] = "Unknown 'registry of objects'";
out << jdata.dump(); out << jdata.dump();
out.flush(); out.flush();
return; return;
...@@ -54,6 +55,7 @@ void UHttpRequestHandler::handleRequest( Poco::Net::HTTPServerRequest& req, Poco ...@@ -54,6 +55,7 @@ void UHttpRequestHandler::handleRequest( Poco::Net::HTTPServerRequest& req, Poco
nlohmann::json jdata; nlohmann::json jdata;
jdata["error"] = resp.getReasonForStatus(resp.getStatus()); jdata["error"] = resp.getReasonForStatus(resp.getStatus());
jdata["ecode"] = resp.getStatus(); jdata["ecode"] = resp.getStatus();
jdata["message"] = "method must be 'GET'";
out << jdata.dump(); out << jdata.dump();
out.flush(); out.flush();
return; return;
...@@ -79,6 +81,7 @@ void UHttpRequestHandler::handleRequest( Poco::Net::HTTPServerRequest& req, Poco ...@@ -79,6 +81,7 @@ void UHttpRequestHandler::handleRequest( Poco::Net::HTTPServerRequest& req, Poco
nlohmann::json jdata; nlohmann::json jdata;
jdata["error"] = resp.getReasonForStatus(resp.getStatus()); jdata["error"] = resp.getReasonForStatus(resp.getStatus());
jdata["ecode"] = resp.getStatus(); jdata["ecode"] = resp.getStatus();
jdata["message"] = "BAD REQUEST STRUCTURE";
out << jdata.dump(); out << jdata.dump();
out.flush(); out.flush();
return; return;
......
...@@ -229,7 +229,7 @@ void UniSetObject::registered() ...@@ -229,7 +229,7 @@ void UniSetObject::registered()
if( myid == uniset::DefaultObjectId ) if( myid == uniset::DefaultObjectId )
{ {
uinfo << myname << "(registered): Don`t registration. myid=DefaultObjectId \n"; ulogrep << myname << "(registered): Don`t registration. myid=DefaultObjectId \n";
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment