Skip to content

Commit c9ace8a

Browse files
committed
Debug flag
1 parent c3fe5ab commit c9ace8a

File tree

6 files changed

+23
-9
lines changed

6 files changed

+23
-9
lines changed

dist/grading/Logger.d.ts

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js

Lines changed: 9 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/grading/Logger.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@ export default class Logger {
77
}[] = []
88
constructor(private regressionTestJob?: number) {}
99

10+
get isVerboseDebug() {
11+
return (
12+
this.regressionTestJob !== undefined ||
13+
(process.env.GRADER_DEBUG &&
14+
process.env.GRADER_DEBUG.toLowerCase() !== 'false')
15+
)
16+
}
17+
1018
log(visibility: OutputVisibility, message: string) {
1119
if (visibility === 'visible') {
1220
console.log(message)
13-
} else if (this.regressionTestJob) {
21+
} else if (this.isVerboseDebug) {
1422
console.log(`CIDebug: ${message}`)
1523
}
1624
this.output.push({

src/grading/builders/Builder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ export abstract class Builder {
6464
child.stdout.on('data', (data: Buffer) => {
6565
const output = data.toString()
6666
myOutput += output
67-
if (this.regressionTestJob) {
67+
if (this.logger.isVerboseDebug) {
6868
console.log(`CIDebug: ${output}`)
6969
}
7070
})
7171

7272
child.stderr.on('data', (data: Buffer) => {
7373
const error = data.toString()
7474
myError += error
75-
if (this.regressionTestJob) {
75+
if (this.logger.isVerboseDebug) {
7676
console.log(`CIDebug: ${error}`)
7777
}
7878
})

src/grading/graders/OverlayGrader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ export class OverlayGrader extends Grader<OverlayPawtograderConfig> {
705705
this.gradePart(part, testResults, mutantResults, mutantFailureAdvice)
706706
)
707707
.flat()
708-
if (this.regressionTestJob) {
708+
if (this.logger.isVerboseDebug) {
709709
console.log('DEBUG: Test results')
710710
console.log(JSON.stringify(testFeedbacks, null, 2))
711711
}

0 commit comments

Comments
 (0)