Skip to content

Commit

Permalink
Show debug output when verbose and fail/error
Browse files Browse the repository at this point in the history
  • Loading branch information
elpete committed Sep 6, 2024
1 parent 61843bd commit 84e7523
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions models/CLIRenderer.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
*/
component {

property name="JSONPrettyPrint" inject="provider:JSONPrettyPrint";
property name='JSONService' inject='JSONService';

processingdirective pageEncoding="UTF-8";

variables.HEADER_CELL_CHARS = 7;
Expand Down Expand Up @@ -296,6 +299,18 @@ component {
"#repeatString( " ", arguments.level + 2 )#-> Failure: #local.thisSpec.failMessage##chr( 13 )#",
COLOR.FAIL
);

param local.thisSpec.debugBuffer = [];
if ( verbose && !local.thisSpec.debugBuffer.isEmpty() ) {
print.text( repeatString( " ", level + 2 ) ).boldWhiteOnGreenLine( "Debug Buffer:" );
print.line(
JSONPrettyPrint.formatJSON(
json = local.thisSpec.debugBuffer,
ansiColors = JSONService.getANSIColors()
).listToArray( chr( 10 ) )
.map( ( line ) => "#repeatString( " ", level + 2 )##line#" ).toList( chr( 10 ) )
).line();
}
}

if ( local.thisSpec.status == "error" ) {
Expand Down Expand Up @@ -340,6 +355,18 @@ component {
}
}
} );

param local.thisSpec.debugBuffer = [];
if ( verbose && !local.thisSpec.debugBuffer.isEmpty() ) {
print.text( repeatString( " ", level + 2 ) ).boldWhiteOnGreenLine( "Debug Buffer:" );
print.line(
JSONPrettyPrint.formatJSON(
json = local.thisSpec.debugBuffer,
ansiColors = JSONService.getANSIColors()
).listToArray( chr( 10 ) )
.map( ( line ) => "#repeatString( " ", level + 2 )##line#" ).toList( chr( 10 ) )
).line();
}
}
}

Expand Down

0 comments on commit 84e7523

Please sign in to comment.