File tree Expand file tree Collapse file tree 1 file changed +31
-7
lines changed
Plugins/AWSLambdaPackager Expand file tree Collapse file tree 1 file changed +31
-7
lines changed Original file line number Diff line number Diff line change @@ -226,11 +226,17 @@ struct AWSLambdaPackager: CommandPlugin {
226226 guard let _output = data. flatMap ( { String ( data: $0, encoding: . utf8) ? . trimmingCharacters ( in: CharacterSet ( [ " \n " ] ) ) } ) , !_output. isEmpty else {
227227 return
228228 }
229- if logLevel >= . output {
229+
230+ output += _output + " \n "
231+
232+ switch logLevel {
233+ case . silent:
234+ break
235+ case . debug( let outputIndent) , . output( let outputIndent) :
236+ print ( String ( repeating: " " , count: outputIndent) , terminator: " " )
230237 print ( _output)
231238 fflush ( stdout)
232239 }
233- output += _output + " \n "
234240 }
235241
236242 let pipe = Pipe ( )
@@ -359,13 +365,31 @@ private struct Configuration: CustomStringConvertible {
359365 }
360366}
361367
362- private enum ProcessLogLevel : Int , Comparable {
363- case silent = 0
364- case output = 1
365- case debug = 2
368+ private enum ProcessLogLevel : Comparable {
369+ case silent
370+ case output( outputIndent: Int )
371+ case debug( outputIndent: Int )
372+
373+ var naturalOrder : Int {
374+ switch self {
375+ case . silent:
376+ return 0
377+ case . output:
378+ return 1
379+ case . debug:
380+ return 2
381+ }
382+ }
383+
384+ static var output : Self {
385+ . output( outputIndent: 2 )
386+ }
387+ static var debug : Self {
388+ . debug( outputIndent: 2 )
389+ }
366390
367391 static func < ( lhs: ProcessLogLevel , rhs: ProcessLogLevel ) -> Bool {
368- lhs. rawValue < rhs. rawValue
392+ lhs. naturalOrder < rhs. naturalOrder
369393 }
370394}
371395
You can’t perform that action at this time.
0 commit comments