Skip to content

Commit 7276fcd

Browse files
committed
disable rich print for debug_log
takes ages to format large logs
1 parent fc26812 commit 7276fcd

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/warnet/cli/main.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import click
2-
from rich import print
2+
from rich import print as richprint
33

44
from templates import TEMPLATES
55
from warnet.cli.debug import debug
@@ -30,14 +30,14 @@ def help_command(ctx, command):
3030
"""
3131
if command is None:
3232
# Display help for the main CLI
33-
print(ctx.parent.get_help())
33+
richprint(ctx.parent.get_help())
3434
return
3535

3636
# Fetch the command object
3737
cmd_obj = cli.get_command(ctx, command)
3838

3939
if cmd_obj is None:
40-
print(f"Unknown command: {command}")
40+
richprint(f"Unknown command: {command}")
4141
return
4242

4343
# Extract only the relevant help information (excluding the initial usage line)
@@ -61,7 +61,7 @@ def help_command(ctx, command):
6161
args_str = " ".join(arguments)
6262
usage_str = f"Usage: warnet {command} [OPTIONS] {args_str}\n\n{help_info}"
6363

64-
print(usage_str)
64+
richprint(usage_str)
6565

6666

6767
cli.add_command(help_command)
@@ -91,9 +91,9 @@ def rpc(node, method, params, network):
9191
"bcli",
9292
{"network": network, "node": node, "method": method_str, "params": params},
9393
)
94-
print(result)
94+
richprint(result)
9595
except Exception as e:
96-
print(f"bitcoin-cli {method_str} {params} failed on node {node}:\n{e}")
96+
richprint(f"bitcoin-cli {method_str} {params} failed on node {node}:\n{e}")
9797

9898

9999
@cli.command()
@@ -107,7 +107,7 @@ def debug_log(node, network):
107107
result = rpc_call("debug_log", {"node": node, "network": network})
108108
print(result)
109109
except Exception as e:
110-
print(f"In our pursuit of knowledge from node {node}, we were thwarted: {e}")
110+
richprint(f"In our pursuit of knowledge from node {node}, we were thwarted: {e}")
111111

112112

113113
@cli.command()
@@ -125,9 +125,9 @@ def messages(node_a, node_b, network):
125125
result = rpc_call(
126126
"messages", {"network": network, "node_a": node_a, "node_b": node_b}
127127
)
128-
print(result)
128+
richprint(result)
129129
except Exception as e:
130-
print(
130+
richprint(
131131
f"Error fetching messages between {node_a} and {node_b}: {e}"
132132
)
133133

@@ -139,9 +139,9 @@ def stop():
139139
"""
140140
try:
141141
result = rpc_call("stop", None)
142-
print(result)
142+
richprint(result)
143143
except Exception as e:
144-
print(f"Error stopping warnetd: {e}")
144+
richprint(f"Error stopping warnetd: {e}")
145145

146146

147147
if __name__ == "__main__":

0 commit comments

Comments
 (0)