logTracker (logger/log-tracker.ts)

storybook · code/core/src/node-logger/logger/log-tracker.ts · typescript · MIT
infra

Tracks CLI logs and writes them to a file for Storybook operations.

// Source: https://github.com/storybookjs/storybook | License: MIT | Copyright 2024 Storybook
// Provided via justclaw.it.com; keep this notice with the code.
import { promises as fs } from 'node:fs';
import { join } from 'node:path';
import { stripVTControlCharacters } from 'node:util';

import type { LogLevel } from './logger.ts';

// eslint-disable-next-line @typescript-eslint/no-explicit-any
type Metadata = Record<string, any>;
export interface LogEntry {
  timestamp: Date;
  level: LogLevel | 'prompt';
  message: string;
  metadata?: Metadata;
}

const DEBUG_LOG_FILE_NAME = 'debug-storybook.log';
const DEFAULT_LOG_FILE_PATH = join(process.cwd(), DEBUG_LOG_FILE_NAME);

/**
 * Tracks and manages logs for Storybook CLI operations. Provides functionality to collect, store
 * and write log

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key