Skip to content

Commit 7820ea6

Browse files
chore: set debug verbose on stderr-filtering logs (#32436)
1 parent 5719c84 commit 7820ea6

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

packages/stderr-filtering/lib/FilterTaggedContent.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { StringDecoder } from 'string_decoder'
33
import { LineDecoder } from './LineDecoder'
44
import Debug from 'debug'
55
import { writeWithBackpressure } from './writeWithBackpressure'
6-
const debug = Debug('cypress:stderr-filtering:FilterTaggedContent')
6+
const debugVerbose = Debug('cypress-verbose:stderr-filtering:FilterTaggedContent')
77

88
/**
99
* Filters content based on start and end tags, supporting multi-line tagged content.
@@ -53,7 +53,7 @@ export class FilterTaggedContent extends Transform {
5353

5454
this.lineDecoder?.write(str)
5555

56-
debug('processing str for tags: "%s"', str)
56+
debugVerbose('processing str for tags: "%s"', str)
5757

5858
for (const line of Array.from(this.lineDecoder || [])) {
5959
await this.processLine(line)
@@ -71,7 +71,7 @@ export class FilterTaggedContent extends Transform {
7171
* @param callback Callback to call when flushing is complete
7272
*/
7373
flush = async (callback: (err?: Error) => void) => {
74-
debug('flushing')
74+
debugVerbose('flushing')
7575
this.ensureDecoders()
7676
try {
7777
for (const line of Array.from(this.lineDecoder?.end() || [])) {
@@ -146,12 +146,12 @@ export class FilterTaggedContent extends Transform {
146146
}
147147

148148
private async writeToWasteStream (line: string, encoding?: BufferEncoding | 'buffer') {
149-
debug('writing to waste stream: "%s"', line)
149+
debugVerbose('writing to waste stream: "%s"', line)
150150
await writeWithBackpressure(this.wasteStream, Buffer.from(line, (encoding === 'buffer' ? 'utf8' : encoding) ?? 'utf8'))
151151
}
152152

153153
private async pass (line: string, encoding?: BufferEncoding | 'buffer') {
154-
debug('passing: "%s"', line)
154+
debugVerbose('passing: "%s"', line)
155155
this.push(Buffer.from(line, (encoding === 'buffer' ? 'utf8' : encoding) ?? 'utf8'))
156156
}
157157
}

packages/stderr-filtering/lib/LineDecoder.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import Debug from 'debug'
1111
import { END_TAG } from './constants'
1212

13-
const debug = Debug(`cypress:stderr-filtering:LineDecoder:${process.pid}`)
13+
const debugVerbose = Debug(`cypress-verbose:stderr-filtering:LineDecoder:${process.pid}`)
1414

1515
export class LineDecoder {
1616
private buffer: string = ''
@@ -23,7 +23,7 @@ export class LineDecoder {
2323
* @param chunk The string chunk to add to the buffer
2424
*/
2525
public write (chunk: string) {
26-
debug('writing chunk to line decoder', { chunk })
26+
debugVerbose('writing chunk to line decoder', { chunk })
2727
this.buffer += chunk
2828
}
2929

@@ -37,16 +37,16 @@ export class LineDecoder {
3737
* @yields Complete lines with newline characters preserved
3838
*/
3939
* [Symbol.iterator] (): Generator<string> {
40-
debug('iterating over lines in line decoder')
40+
debugVerbose('iterating over lines in line decoder')
4141

4242
let nextLine: string | undefined = undefined
4343

4444
do {
4545
nextLine = this.nextLine()
4646

4747
if (nextLine) {
48-
debug('yielding line:', nextLine)
49-
debug('buffer size:', this.buffer.length)
48+
debugVerbose('yielding line:', nextLine)
49+
debugVerbose('buffer size:', this.buffer.length)
5050
yield nextLine
5151
}
5252
} while (nextLine)
@@ -79,7 +79,7 @@ export class LineDecoder {
7979
const endsWithOverrideToken = newlineIndex < 0 ? this.buffer.endsWith(this.overrideToken) : false
8080

8181
if (endsWithOverrideToken) {
82-
debug('ends with override token')
82+
debugVerbose('ends with override token')
8383
const line = this.buffer
8484

8585
this.buffer = ''
@@ -88,7 +88,7 @@ export class LineDecoder {
8888
}
8989

9090
if (newlineIndex >= 0) {
91-
debug('contains a newline')
91+
debugVerbose('contains a newline')
9292
const line = this.buffer.slice(0, newlineIndex + length)
9393

9494
this.buffer = this.buffer.slice(newlineIndex + length)

0 commit comments

Comments
 (0)