Skip to content

Commit

Permalink
Adds a new commandline option to dump JSON RPC calls to a file (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
ESultanik committed Mar 26, 2019
1 parent 8819ae1 commit 18c17e2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion etheno/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from .echidna import echidna_exists, EchidnaPlugin, install_echidna
from .etheno import app, EthenoView, GETH_DEFAULT_RPC_PORT, ETHENO, VERSION_NAME
from .genesis import Account, make_accounts, make_genesis
from .jsonrpc import JSONRPCExportPlugin
from .synchronization import AddressSynchronizingClient, RawTransactionClient
from .utils import clear_directory, decode_value, find_open_port, format_hex_address, ynprompt
from . import Etheno
Expand Down Expand Up @@ -60,6 +61,7 @@ def main(argv = None):
parser.add_argument('-l', '--log-level', type=str.upper, choices={'CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG'}, default='INFO', help='Set Etheno\'s log level (default=INFO)')
parser.add_argument('--log-file', type=str, default=None, help='Path to save all log output to a single file')
parser.add_argument('--log-dir', type=str, default=None, help='Path to a directory in which to save all log output, divided by logging source')
parser.add_argument('-d', '--dump-jsonrpc', type=str, default=None, help='Path to a JSON file in which to dump all raw JSON RPC calls; if `--log-dir` is provided, the raw JSON RPC calls will additionally be dumped to `rpc.json` in the log directory.')
parser.add_argument('-v', '--version', action='store_true', default=False, help='Print version information and exit')
parser.add_argument('client', type=str, nargs='*', help='JSON RPC client URLs to multiplex; if no client is specified for --master, the first client in this list will default to the master (format="http://foo.com:8545/")')
parser.add_argument('-s', '--master', type=str, default=None, help='A JSON RPC client to use as the master (format="http://foo.com:8545/")')
Expand Down Expand Up @@ -103,7 +105,12 @@ def main(argv = None):
if not args.log_file:
# Also create a unified log in the log dir:
ETHENO.logger.save_to_file(os.path.join(args.log_dir, 'Complete.log'))


ETHENO.add_plugin(JSONRPCExportPlugin(os.path.join(args.log_dir, 'rpc.json')))

if args.dump_jsonrpc is not None:
ETHENO.add_plugin(JSONRPCExportPlugin(args.dump_jsonrpc))

# First, see if we need to install Echidna:
if args.echidna:
if not echidna_exists():
Expand Down

0 comments on commit 18c17e2

Please sign in to comment.