aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmarshallnz <jcmarsha@gmail.com>2014-03-15 14:05:55 +1300
committerJonathan Marshall <jmarshall@xbmc.org>2014-03-15 14:58:41 +1300
commita1cab7afcba085b16b1f14caa0f6b88e62488794 (patch)
treea9e6b94c2ddc3deff31d97969fcd8a8e354b763e
parent9e6a97c223927dc680ba545dfcbf2ed42cd3a5fc (diff)
Merge pull request #4428 from Montellese/jsonrpc_optional_loggingGotham_beta2
JSON-RPC: make logging of incoming requests optional and configurable
-rw-r--r--addons/xbmc.debug/resources/language/English/strings.po4
-rw-r--r--addons/xbmc.debug/resources/settings.xml1
-rw-r--r--xbmc/commons/ilog.h1
-rw-r--r--xbmc/interfaces/json-rpc/JSONRPC.cpp4
-rw-r--r--xbmc/interfaces/json-rpc/JSONServiceDescription.cpp2
5 files changed, 10 insertions, 2 deletions
diff --git a/addons/xbmc.debug/resources/language/English/strings.po b/addons/xbmc.debug/resources/language/English/strings.po
index 27f3d1da1c..b55435b795 100644
--- a/addons/xbmc.debug/resources/language/English/strings.po
+++ b/addons/xbmc.debug/resources/language/English/strings.po
@@ -39,3 +39,7 @@ msgstr ""
msgctxt "#30005"
msgid "Verbose logging for DBUS calls"
msgstr ""
+
+msgctxt "#30006"
+msgid "Verbose logging for JSON-RPC requests"
+msgstr ""
diff --git a/addons/xbmc.debug/resources/settings.xml b/addons/xbmc.debug/resources/settings.xml
index 2644a96917..71b74500c8 100644
--- a/addons/xbmc.debug/resources/settings.xml
+++ b/addons/xbmc.debug/resources/settings.xml
@@ -6,4 +6,5 @@
<setting id="bit4" type="bool" label="30003" default="0"/>
<setting id="bit5" type="bool" label="30004" default="0"/>
<setting id="bit6" type="bool" label="30005" default="0"/>
+ <setting id="bit7" type="bool" label="30006" default="0"/>
</settings>
diff --git a/xbmc/commons/ilog.h b/xbmc/commons/ilog.h
index 868c7c838a..eaa8a050bd 100644
--- a/xbmc/commons/ilog.h
+++ b/xbmc/commons/ilog.h
@@ -48,6 +48,7 @@
#define LOGFFMPEG (1 << (LOGMASKBIT+3))
#define LOGRTMP (1 << (LOGMASKBIT+4))
#define LOGDBUS (1 << (LOGMASKBIT+5))
+#define LOGJSONRPC (1 << (LOGMASKBIT+6))
#ifdef __GNUC__
#define ATTRIB_LOG_FORMAT __attribute__((format(printf,3,4)))
diff --git a/xbmc/interfaces/json-rpc/JSONRPC.cpp b/xbmc/interfaces/json-rpc/JSONRPC.cpp
index f36b326aed..036728719f 100644
--- a/xbmc/interfaces/json-rpc/JSONRPC.cpp
+++ b/xbmc/interfaces/json-rpc/JSONRPC.cpp
@@ -232,7 +232,9 @@ CStdString CJSONRPC::MethodCall(const CStdString &inputString, ITransportLayer *
CVariant inputroot, outputroot, result;
bool hasResponse = false;
- CLog::Log(LOGDEBUG, "JSONRPC: Incoming request: %s", inputString.c_str());
+ if(g_advancedSettings.m_extraLogLevels & LOGJSONRPC)
+ CLog::Log(LOGDEBUG, "JSONRPC: Incoming request: %s", inputString.c_str());
+
inputroot = CJSONVariantParser::Parse((unsigned char *)inputString.c_str(), inputString.length());
if (!inputroot.isNull())
{
diff --git a/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp b/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp
index cfbfafe59a..c278bb197e 100644
--- a/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp
+++ b/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp
@@ -1515,7 +1515,7 @@ bool CJSONServiceDescription::AddType(const std::string &jsonType)
if (!globalType->Parse(descriptionObject[typeName]))
{
- CLog::Log(LOGERROR, "JSONRPC: Could not parse type \"%s\"", typeName.c_str());
+ CLog::Log(LOGWARNING, "JSONRPC: Could not parse type \"%s\"", typeName.c_str());
CJSONServiceDescription::removeReferenceTypeDefinition(typeName);
if (!globalType->missingReference.empty())
{