@@ -30,7 +30,7 @@ enum CodexBarCLI {
3030
3131 do {
3232 let invocation = try program. resolve ( argv: argv)
33- Self . bootstrapLogging ( values: invocation. parsedValues)
33+ Self . bootstrapLogging ( path : invocation . path , values: invocation. parsedValues)
3434 switch invocation. path {
3535 case [ " usage " ] :
3636 await self . runUsage ( invocation. parsedValues)
@@ -155,12 +155,17 @@ enum CodexBarCLI {
155155
156156 // MARK: - Helpers
157157
158- private static func bootstrapLogging( values: ParsedValues ) {
158+ private static func bootstrapLogging( path: [ String ] , values: ParsedValues ) {
159+ CodexBarLog . bootstrapIfNeeded ( self . loggingConfiguration ( path: path, values: values) )
160+ }
161+
162+ static func loggingConfiguration( path: [ String ] , values: ParsedValues ) -> CodexBarLog . Configuration {
159163 let isJSON = values. flags. contains ( " jsonOutput " ) || values. flags. contains ( " jsonOnly " )
160164 let verbose = values. flags. contains ( " verbose " )
161165 let rawLevel = values. options [ " logLevel " ] ? . last
162166 let level = Self . resolvedLogLevel ( verbose: verbose, rawLevel: rawLevel)
163- CodexBarLog . bootstrapIfNeeded ( . init( destination: . stderr, level: level, json: isJSON) )
167+ let destination : CodexBarLog . Destination = path == [ " diagnose " ] ? . discard : . stderr
168+ return . init( destination: destination, level: level, json: isJSON)
164169 }
165170
166171 static func resolvedLogLevel( verbose: Bool , rawLevel: String ? ) -> CodexBarLog . Level {
0 commit comments