@@ -34,6 +34,7 @@ def custom_graph(
3434 fork_observer : bool ,
3535 fork_obs_query_interval : int ,
3636 caddy : bool ,
37+ logging : bool ,
3738):
3839 datadir .mkdir (parents = False , exist_ok = False )
3940 # Generate network.yaml
@@ -79,10 +80,13 @@ def custom_graph(
7980 # Generate node-defaults.yaml
8081 default_yaml_path = files ("resources.networks" ).joinpath ("node-defaults.yaml" )
8182 with open (str (default_yaml_path )) as f :
82- defaults_yaml_content = f .read ()
83+ defaults_yaml_content = yaml .safe_load (f )
84+
85+ # Configure logging
86+ defaults_yaml_content ["collectLogs" ] = logging
8387
8488 with open (os .path .join (datadir , "node-defaults.yaml" ), "w" ) as f :
85- f . write (defaults_yaml_content )
89+ yaml . dump (defaults_yaml_content , f , default_flow_style = False , sort_keys = False )
8690
8791 click .echo (
8892 f"Project '{ datadir } ' has been created with 'network.yaml' and 'node-defaults.yaml'."
@@ -175,6 +179,15 @@ def inquirer_create_network(project_path: Path):
175179 type = int ,
176180 default = 20 ,
177181 )
182+
183+ logging = click .prompt (
184+ click .style (
185+ "\n Would you like to enable grafana logging on the network?" , fg = "blue" , bold = True
186+ ),
187+ type = bool ,
188+ default = False ,
189+ )
190+ caddy = fork_observer | logging
178191 custom_network_path = project_path / "networks" / net_answers ["network_name" ]
179192 click .secho ("\n Generating custom network..." , fg = "yellow" , bold = True )
180193 custom_graph (
@@ -184,7 +197,8 @@ def inquirer_create_network(project_path: Path):
184197 custom_network_path ,
185198 fork_observer ,
186199 fork_observer_query_interval ,
187- fork_observer , # This enables caddy whenever fork-observer is enabled
200+ caddy ,
201+ logging ,
188202 )
189203 return custom_network_path
190204
0 commit comments