API reference@evolu/commonConsole › ConsoleStoreOutput

Defined in: packages/common/src/Console.ts:341

A ConsoleOutput that stores the latest entry in a ReadonlyStore.

Subscribe to ConsoleStoreOutput.entry to observe all log entries.

Example

import {
  createConsole,
  createConsoleStoreOutput,
  type ConsoleEntry,
} from "@evolu/common";

const storeOutput = createConsoleStoreOutput();
const console = createConsole({ output: storeOutput });
let forwardedEntry: ConsoleEntry | null = null;
const unsubscribe = storeOutput.entry.subscribe(() => {
  forwardedEntry = storeOutput.entry.get();
});

console.child("relay").info("connected");
unsubscribe();

expect(forwardedEntry).toEqual({
  method: "info",
  path: ["relay"],
  args: ["connected"],
});

Extends

Properties

entry

readonly entry: ReadonlyStore<
  | ConsoleEntry
| null>;

Defined in: packages/common/src/Console.ts:343

Latest entry written to this output.


write

readonly write: (entry: ConsoleEntry, formatter?: ConsoleFormatter) => void;

Defined in: packages/common/src/Console.ts:246

Write a log entry to this output.

Inherited from

ConsoleOutput.write