Add a 'logpath' field to getrpcinfo

This commit is contained in:
darosior 2019-05-16 23:01:00 +02:00
parent 8f2f17f79a
commit 8a6810d0d2
No known key found for this signature in database
GPG key ID: E13FC145CD3F4304
2 changed files with 6 additions and 0 deletions

View file

@ -234,6 +234,10 @@ static UniValue getrpcinfo(const JSONRPCRequest& request)
UniValue result(UniValue::VOBJ); UniValue result(UniValue::VOBJ);
result.pushKV("active_commands", active_commands); result.pushKV("active_commands", active_commands);
const std::string path = LogInstance().m_file_path.string();
UniValue log_path(UniValue::VSTR, path);
result.pushKV("logpath", log_path);
return result; return result;
} }

View file

@ -4,6 +4,7 @@
# file COPYING or http://www.opensource.org/licenses/mit-license.php. # file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Tests some generic aspects of the RPC interface.""" """Tests some generic aspects of the RPC interface."""
import os
from test_framework.authproxy import JSONRPCException from test_framework.authproxy import JSONRPCException
from test_framework.test_framework import BitcoinTestFramework from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_equal, assert_greater_than_or_equal from test_framework.util import assert_equal, assert_greater_than_or_equal
@ -31,6 +32,7 @@ class RPCInterfaceTest(BitcoinTestFramework):
command = info['active_commands'][0] command = info['active_commands'][0]
assert_equal(command['method'], 'getrpcinfo') assert_equal(command['method'], 'getrpcinfo')
assert_greater_than_or_equal(command['duration'], 0) assert_greater_than_or_equal(command['duration'], 0)
assert_equal(info['logpath'], os.path.join(self.nodes[0].datadir, 'regtest', 'debug.log'))
def test_batch_request(self): def test_batch_request(self):
self.log.info("Testing basic JSON-RPC batch request...") self.log.info("Testing basic JSON-RPC batch request...")