Home / Class/ SpyLogger Class — astro Architecture

SpyLogger Class — astro Architecture

Architecture documentation for the SpyLogger class in test-utils.js from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  e6d936de_adfc_6f29_c26b_58af0a66adc5["SpyLogger"]
  b0be4d0c_86b6_a283_f2af_003189bfd572["test-utils.js"]
  e6d936de_adfc_6f29_c26b_58af0a66adc5 -->|defined in| b0be4d0c_86b6_a283_f2af_003189bfd572
  8fe1f031_a5bf_3ef3_42b6_55294f3285f9["logs()"]
  e6d936de_adfc_6f29_c26b_58af0a66adc5 -->|method| 8fe1f031_a5bf_3ef3_42b6_55294f3285f9
  76f86ed0_45c8_79a0_fb80_93333f67b83f["debug()"]
  e6d936de_adfc_6f29_c26b_58af0a66adc5 -->|method| 76f86ed0_45c8_79a0_fb80_93333f67b83f
  339fe9c4_3feb_1557_7c85_ffdd33c4be4d["error()"]
  e6d936de_adfc_6f29_c26b_58af0a66adc5 -->|method| 339fe9c4_3feb_1557_7c85_ffdd33c4be4d
  3d396820_280c_2bc8_d511_a2aa3b3004c2["info()"]
  e6d936de_adfc_6f29_c26b_58af0a66adc5 -->|method| 3d396820_280c_2bc8_d511_a2aa3b3004c2
  b5ba8666_f65b_a577_f6e5_23af008ccac3["warn()"]
  e6d936de_adfc_6f29_c26b_58af0a66adc5 -->|method| b5ba8666_f65b_a577_f6e5_23af008ccac3
  cfa5822e_654a_3f8f_8c96_87b2efcb15d5["level()"]
  e6d936de_adfc_6f29_c26b_58af0a66adc5 -->|method| cfa5822e_654a_3f8f_8c96_87b2efcb15d5
  4e284500_ee49_ddff_3545_396dcc7042fa["forkIntegrationLogger()"]
  e6d936de_adfc_6f29_c26b_58af0a66adc5 -->|method| 4e284500_ee49_ddff_3545_396dcc7042fa

Relationship Graph

Source Code

packages/astro/test/units/test-utils.js lines 172–203

export class SpyLogger {
	/** @type {Array<{ type: string; label: string | null; message: string }>} */
	#logs = [];
	get logs() {
		return this.#logs;
	}

	debug(label, ...messages) {
		this.#logs.push(...messages.map((message) => ({ type: 'debug', label, message })));
	}
	error(label, message) {
		this.#logs.push({ type: 'error', label, message });
	}
	info(label, message) {
		this.#logs.push({ type: 'info', label, message });
	}
	warn(label, message) {
		this.#logs.push({ type: 'warn', label, message });
	}
	options = {
		dest: {
			write: () => true,
		},
		level: /** @type {const} */ ('silent'),
	};
	level() {
		return this.options.level;
	}
	forkIntegrationLogger(label) {
		return new AstroIntegrationLogger(this.options, label);
	}
}

Frequently Asked Questions

What is the SpyLogger class?
SpyLogger is a class in the astro codebase, defined in packages/astro/test/units/test-utils.js.
Where is SpyLogger defined?
SpyLogger is defined in packages/astro/test/units/test-utils.js at line 172.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free