3
3
using System . CommandLine . IO ;
4
4
using System . Text ;
5
5
using HotChocolate . Fusion . Logging ;
6
- using HotChocolate . Fusion . Results ;
7
- using HotChocolate . Types . Mutable ;
8
6
using static HotChocolate . Fusion . Properties . CommandLineResources ;
9
7
10
8
namespace HotChocolate . Fusion . Commands ;
@@ -97,7 +95,10 @@ private static async Task<int> ExecuteAsync(
97
95
98
96
var result = schemaComposer . Compose ( ) ;
99
97
100
- WriteCompositionLog ( compositionLog , console , result ) ;
98
+ WriteCompositionLog (
99
+ compositionLog ,
100
+ writer : result . IsSuccess ? console . Out : console . Error ,
101
+ writeAsGraphQLComments : result . IsSuccess && compositeSchemaFile is null ) ;
101
102
102
103
if ( result . IsFailure )
103
104
{
@@ -138,11 +139,10 @@ await File.WriteAllTextAsync(
138
139
139
140
private static void WriteCompositionLog (
140
141
CompositionLog compositionLog ,
141
- IConsole console ,
142
- CompositionResult < MutableSchemaDefinition > result )
142
+ IStandardStreamWriter writer ,
143
+ bool writeAsGraphQLComments )
143
144
{
144
145
Console . OutputEncoding = Encoding . UTF8 ;
145
- var writer = result . IsSuccess ? console . Out : console . Error ;
146
146
147
147
foreach ( var entry in compositionLog )
148
148
{
@@ -164,8 +164,7 @@ private static void WriteCompositionLog(
164
164
165
165
var message = $ "{ emoji } [{ abbreviatedSeverity } ] { entry . Message } ({ entry . Code } )";
166
166
167
- // When the composition is successful, write log entries as GraphQL comments.
168
- if ( result . IsSuccess )
167
+ if ( writeAsGraphQLComments )
169
168
{
170
169
message = $ "# { message } ";
171
170
}
0 commit comments