@@ -46,9 +46,9 @@ pub fn init_subscriber(log_path: Option<Box<Path>>) {
4646 . with ( error_layer)
4747 . init ( ) ;
4848 //tracing_subscriber::registry()
49- // .with(tracing_subscriber::layer::Layer::and_then(formatting_layer, error_layer).with_filter(env_filter))
50- // .with(console_layer)
51- // .init();
49+ // .with(tracing_subscriber::layer::Layer::and_then(formatting_layer, error_layer).with_filter(env_filter))
50+ // .with(console_layer)
51+ // .init();
5252 } ;
5353
5454 match log_path {
@@ -150,30 +150,7 @@ pub fn unexpected_response_str(s: &str) -> eyre::Report {
150150 Ok ( v) => serde_json:: to_string_pretty ( & v) . unwrap ( ) ,
151151 Err ( _) => s. to_owned ( ) ,
152152 } ;
153- let report = report_msg ( s) ;
153+ let report = v_utils :: utils :: report_msg ( s) ;
154154 report. wrap_err ( "Unexpected API response" )
155155}
156156//,}}}
157-
158- /// Constructs `eyre::Report` with capped size
159- #[ track_caller]
160- #[ named]
161- pub fn report_msg ( s : String ) -> eyre:: Report {
162- let lines: Vec < & str > = s. lines ( ) . collect ( ) ;
163- let total_lines = lines. len ( ) ;
164-
165- let truncated_message = if total_lines > 50 {
166- let first_25 = & lines[ ..25 ] ;
167- let last_25 = & lines[ total_lines - 25 ..] ;
168- let truncation_message = format ! ( "------------------------- // truncated at {} by `{}`\n " , std:: panic:: Location :: caller( ) , function_name!( ) ) ;
169- let concat_message = format ! ( "{}\n {truncation_message}{}" , first_25. join( "\n " ) , last_25. join( "\n " ) ) ;
170-
171- tracing:: trace!( "Had to concat an error message\n :{s}" ) ;
172-
173- concat_message
174- } else {
175- s
176- } ;
177-
178- eyre:: Report :: msg ( truncated_message)
179- }
0 commit comments