mirror of
https://github.com/cypress-io/cypress.git
synced 2026-01-11 17:30:02 -06:00
chore: set debug verbose on stderr-filtering logs (#32436)
This commit is contained in:
@@ -3,7 +3,7 @@ import { StringDecoder } from 'string_decoder'
|
||||
import { LineDecoder } from './LineDecoder'
|
||||
import Debug from 'debug'
|
||||
import { writeWithBackpressure } from './writeWithBackpressure'
|
||||
const debug = Debug('cypress:stderr-filtering:FilterTaggedContent')
|
||||
const debugVerbose = Debug('cypress-verbose:stderr-filtering:FilterTaggedContent')
|
||||
|
||||
/**
|
||||
* Filters content based on start and end tags, supporting multi-line tagged content.
|
||||
@@ -53,7 +53,7 @@ export class FilterTaggedContent extends Transform {
|
||||
|
||||
this.lineDecoder?.write(str)
|
||||
|
||||
debug('processing str for tags: "%s"', str)
|
||||
debugVerbose('processing str for tags: "%s"', str)
|
||||
|
||||
for (const line of Array.from(this.lineDecoder || [])) {
|
||||
await this.processLine(line)
|
||||
@@ -71,7 +71,7 @@ export class FilterTaggedContent extends Transform {
|
||||
* @param callback Callback to call when flushing is complete
|
||||
*/
|
||||
flush = async (callback: (err?: Error) => void) => {
|
||||
debug('flushing')
|
||||
debugVerbose('flushing')
|
||||
this.ensureDecoders()
|
||||
try {
|
||||
for (const line of Array.from(this.lineDecoder?.end() || [])) {
|
||||
@@ -146,12 +146,12 @@ export class FilterTaggedContent extends Transform {
|
||||
}
|
||||
|
||||
private async writeToWasteStream (line: string, encoding?: BufferEncoding | 'buffer') {
|
||||
debug('writing to waste stream: "%s"', line)
|
||||
debugVerbose('writing to waste stream: "%s"', line)
|
||||
await writeWithBackpressure(this.wasteStream, Buffer.from(line, (encoding === 'buffer' ? 'utf8' : encoding) ?? 'utf8'))
|
||||
}
|
||||
|
||||
private async pass (line: string, encoding?: BufferEncoding | 'buffer') {
|
||||
debug('passing: "%s"', line)
|
||||
debugVerbose('passing: "%s"', line)
|
||||
this.push(Buffer.from(line, (encoding === 'buffer' ? 'utf8' : encoding) ?? 'utf8'))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
import Debug from 'debug'
|
||||
import { END_TAG } from './constants'
|
||||
|
||||
const debug = Debug(`cypress:stderr-filtering:LineDecoder:${process.pid}`)
|
||||
const debugVerbose = Debug(`cypress-verbose:stderr-filtering:LineDecoder:${process.pid}`)
|
||||
|
||||
export class LineDecoder {
|
||||
private buffer: string = ''
|
||||
@@ -23,7 +23,7 @@ export class LineDecoder {
|
||||
* @param chunk The string chunk to add to the buffer
|
||||
*/
|
||||
public write (chunk: string) {
|
||||
debug('writing chunk to line decoder', { chunk })
|
||||
debugVerbose('writing chunk to line decoder', { chunk })
|
||||
this.buffer += chunk
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ export class LineDecoder {
|
||||
* @yields Complete lines with newline characters preserved
|
||||
*/
|
||||
* [Symbol.iterator] (): Generator<string> {
|
||||
debug('iterating over lines in line decoder')
|
||||
debugVerbose('iterating over lines in line decoder')
|
||||
|
||||
let nextLine: string | undefined = undefined
|
||||
|
||||
@@ -45,8 +45,8 @@ export class LineDecoder {
|
||||
nextLine = this.nextLine()
|
||||
|
||||
if (nextLine) {
|
||||
debug('yielding line:', nextLine)
|
||||
debug('buffer size:', this.buffer.length)
|
||||
debugVerbose('yielding line:', nextLine)
|
||||
debugVerbose('buffer size:', this.buffer.length)
|
||||
yield nextLine
|
||||
}
|
||||
} while (nextLine)
|
||||
@@ -79,7 +79,7 @@ export class LineDecoder {
|
||||
const endsWithOverrideToken = newlineIndex < 0 ? this.buffer.endsWith(this.overrideToken) : false
|
||||
|
||||
if (endsWithOverrideToken) {
|
||||
debug('ends with override token')
|
||||
debugVerbose('ends with override token')
|
||||
const line = this.buffer
|
||||
|
||||
this.buffer = ''
|
||||
@@ -88,7 +88,7 @@ export class LineDecoder {
|
||||
}
|
||||
|
||||
if (newlineIndex >= 0) {
|
||||
debug('contains a newline')
|
||||
debugVerbose('contains a newline')
|
||||
const line = this.buffer.slice(0, newlineIndex + length)
|
||||
|
||||
this.buffer = this.buffer.slice(newlineIndex + length)
|
||||
|
||||
Reference in New Issue
Block a user