platform/shared/common/RhodesApp.cpp in rhodes-3.3.0.beta.1 vs platform/shared/common/RhodesApp.cpp in rhodes-3.3.0.beta.2
- old
+ new
@@ -41,10 +41,11 @@
#include "net/AsyncHttp.h"
#include "rubyext/WebView.h"
#include "rubyext/GeoLocation.h"
#include "common/app_build_configs.h"
#include "unzip/unzip.h"
+#include "common/Tokenizer.h"
#include <algorithm>
#ifdef OS_WINCE
#include <winsock.h>
@@ -662,10 +663,40 @@
{
rho_sync_doSyncAllSources(1,"");
rho_http_sendresponse(arg, "");
}
+static void callback_logger(void *arg, String const &query )
+{
+ int nLevel = 0;
+ String strMsg, strCategory;
+
+ CTokenizer oTokenizer(query, "&");
+ while (oTokenizer.hasMoreTokens())
+ {
+ String tok = oTokenizer.nextToken();
+ if (tok.length() == 0)
+ continue;
+
+ if ( String_startsWith( tok, "level=") )
+ {
+ String strLevel = tok.substr(6);
+ convertFromStringA( strLevel.c_str(), nLevel );
+ }else if ( String_startsWith( tok, "msg=") )
+ {
+ strMsg = rho::net::URI::urlDecode(tok.substr(4));
+ }else if ( String_startsWith( tok, "cat=") )
+ {
+ strCategory = rho::net::URI::urlDecode(tok.substr(4));
+ }
+ }
+
+ rhoPlainLog( "", 0, nLevel, strCategory.c_str(), strMsg.c_str() );
+
+ rho_http_sendresponse(arg, "");
+}
+
static void callback_redirect_to(void *arg, String const &strQuery )
{
size_t nUrl = strQuery.find("url=");
String strUrl;
if ( nUrl != String::npos )
@@ -759,9 +790,10 @@
m_httpServer->register_uri("/system/uicreated", callback_uicreated);
m_httpServer->register_uri("/system/uidestroyed", callback_uidestroyed);
m_httpServer->register_uri("/system/loadserversources", callback_loadserversources);
m_httpServer->register_uri("/system/resetDBOnSyncUserChanged", callback_resetDBOnSyncUserChanged);
m_httpServer->register_uri("/system/loadallsyncsources", callback_loadallsyncsources);
+ m_httpServer->register_uri("/system/logger", callback_logger);
}
const char* CRhodesApp::getFreeListeningPort()
{
if ( m_strListeningPorts.length() > 0 )