diff --git a/.changeset/quiet-paws-study.md b/.changeset/quiet-paws-study.md index e6957b83cb..adbc8d1b3d 100644 --- a/.changeset/quiet-paws-study.md +++ b/.changeset/quiet-paws-study.md @@ -2,11 +2,14 @@ '@backstage/plugin-techdocs-backend': patch --- -Output logs from a TechDocs build to a logging transport in addition to existing frontend event stream, for capturing these logs to other sources. +Output logs from a TechDocs build to a logging transport in addition to existing +frontend event stream, for capturing these logs to other sources. -This allows users to capture debugging information around why tech docs fail to build without needing to rely on end users capturing information from their web browser. +This allows users to capture debugging information around why tech docs fail to build +without needing to rely on end users capturing information from their web browser. -The most common use case is to log to the same place as the rest of the backend application logs. +The most common use case is to log to the same place as the rest of the backend +application logs. Sample usage: @@ -25,31 +28,24 @@ import { PluginEnvironment } from '../types'; export default async function createPlugin( env: PluginEnvironment, ): Promise { - // Preparers are responsible for fetching source files for documentation. const preparers = await Preparers.fromConfig(env.config, { logger: env.logger, reader: env.reader, }); - // Docker client (conditionally) used by the generators, based on techdocs.generators config. const dockerClient = new Docker(); const containerRunner = new DockerContainerRunner({ dockerClient }); - // Generators are used for generating documentation sites. const generators = await Generators.fromConfig(env.config, { logger: env.logger, containerRunner, }); - // Publisher is used for - // 1. Publishing generated files to storage - // 2. Fetching files from storage and passing them to TechDocs frontend. const publisher = await Publisher.fromConfig(env.config, { logger: env.logger, discovery: env.discovery, }); - // checks if the publisher is working and logs the result await publisher.getReadiness(); return await createRouter({ @@ -57,6 +53,8 @@ export default async function createPlugin( generators, publisher, logger: env.logger, + // Passing a buildLogTransport as a parameter in createRouter will enable + // capturing build logs to a backend log stream buildLogTransport: env.logger, config: env.config, discovery: env.discovery,