CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-update-electron-app

A drop-in module that adds autoUpdating capabilities to Electron apps

89

1.08x
Overview
Eval results
Files

task.mdevals/scenario-9/

Update Logging Integration

Build a small module that bootstraps the update helper from Dependencies and routes all of its lifecycle messages through a pluggable logger while keeping a readable record.

Capabilities

Logger wiring

  • A provided logger with a log function is passed into the update helper and receives each lifecycle message it emits (feedURL, requestHeaders, checking-for-update, update-available; downloading..., update-not-available, download completion, and errors), prefixed with a custom label. @test

Default logger fallback

  • When no logger is provided, the module uses console to satisfy the update helper while still prefixing and recording lifecycle messages. @test

Lifecycle log history

  • Every lifecycle message that goes through the pluggable logger is captured in memory in the order received and can be read via an exported accessor without mutating the underlying log buffer. @test

Interval passthrough

  • An optional human-friendly interval string is accepted and forwarded unmodified to the update helper together with the logger. @test

Implementation

@generates

API

export interface LifecycleLogger {
  log: (...args: unknown[]) => void;
}

export interface UpdateLoggingOptions {
  logger?: LifecycleLogger;
  label?: string;
  interval?: string;
}

export interface LogEntry {
  label: string;
  message: string;
  args: unknown[];
}

export function startUpdateLogging(options?: UpdateLoggingOptions): void;

export function getLifecycleLog(): LogEntry[];

export function clearLifecycleLog(): void;

Dependencies { .dependencies }

update-electron-app { .dependency }

Provides update lifecycle events and accepts a pluggable logger.

Install with Tessl CLI

npx tessl i tessl/npm-update-electron-app

tile.json