# @genesislcap/foundation-logger

> Genesis Foundation Logger

Latest version **15.82.0** (published 2026-10-22) · SEE LICENSE IN license.txt license · 0 weekly downloads

## Install

```sh
npm install @genesislcap/foundation-logger
pnpm add @genesislcap/foundation-logger
yarn add @genesislcap/foundation-logger
bun add @genesislcap/foundation-logger
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 15.82.0 |
| Published | 2026-10-22 |
| First published | 2023-09-28 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN license.txt |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 74.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | genesisnpm |

## Links

- npm: https://www.npmjs.com/package/@genesislcap/foundation-logger
- Repository: https://github.com/genesislcap/foundation-ui
- Homepage: https://github.com/genesislcap/foundation-ui#readme
- Issues: https://github.com/genesislcap/foundation-ui/issues
- npm.io page: https://npm.io/package/@genesislcap/foundation-logger

## Dependencies (1)

- [consola](https://npm.io/package/consola.md) ^3.0.0

## Recent versions

- 15.82.0 (latest) — 2026-10-22
- 15.81.0-GENC-1660.10 (GENC-1660) — 2026-10-22
- 15.80.0-FUI-2666.1 (FUI-2666) — 2026-10-21
- 15.80.0-GENC-1739.1 (GENC-1739) — 2026-10-21
- 15.79.2-alpha-e9d30db797.0 (canary) — 2026-10-21
- 15.72.0-FUI-2629.7 (FUI-2629) — 2026-10-15
- 15.73.0-FUI-2628.4 (FUI-2628) — 2026-10-14
- 15.71.0-FUI-2650.1 (FUI-2650) — 2026-10-13
- 15.64.0-FUI-0-genx-vulns.1 (FUI-0-genx-vulns) — 2026-10-13
- 15.50.3-holiday-picker.3 (holiday-picker) — 2026-10-07
- 15.53.0-GENC-1662.1 (GENC-1662) — 2026-10-07
- 15.48.0-alpha-830388687.0 (alpha-830388687) — 2026-10-05
- 15.50.0-BACE-0.1 (BACE-0) — 2026-10-05
- 15.46.2-FUI-2625.3 (FUI-2625) — 2026-10-01
- 15.46.5-FUI-2648.1 (FUI-2648) — 2026-10-01
- … 2199 more at https://npm.io/package/@genesislcap/foundation-logger/versions

## README

# @genesislcap/foundation-logger

Documentation for this package is published on the Genesis docs site:

**Docs: [Utility methods](https://docs.genesis.global/docs/develop/client-capabilities/utility-methods/)**

## Log output

Console messages do **not** include an in-message timestamp by default (Chrome's DevTools clock is separate). Opt in with a live global switch so every `createLogger` instance, including those already created by Foundation packages, prefixes messages with local time including milliseconds (for example `11:52:03.412`):

```ts
import { setLogTimestamps } from '@genesislcap/foundation-logger';

setLogTimestamps(true);
```

The flag is stored on `globalThis` via `Symbol.for`, so one call also reaches Module Federation remotes that bundled their own copy of this package (rather than sharing the host's module).

Enable or disable the prefix on one logger only:

```ts
import { createLogger } from '@genesislcap/foundation-logger';

createLogger('demo', { timestamps: true });
createLogger('quiet', { timestamps: false });
createLogger('legacy', { formatOptions: { date: true } });
```

Options passed to `createLogger` are always merged with `defaultLoggerOptions`. Callers that omit `level` therefore get `debug` (this package's default), not Consola's bare `info` default.

A default reporter is only installed in the browser. Outside the browser Consola has no default
reporter, so loggers stay silent unless you pass `reporters` explicitly:

```ts
import { createLogger, TimestampBrowserReporter } from '@genesislcap/foundation-logger';

createLogger('node-side', { reporters: [new TimestampBrowserReporter()] });
```

## Global log reporters

Genesis packages (`foundation-comms`, `foundation-state-machine`, etc.) report messages through their own `createLogger()` instances created at import time. Register a global reporter to observe logs from all foundation loggers across the application, including loggers instantiated before registration and loggers created by Module Federation remotes:

```ts
import { addGlobalLogReporter } from '@genesislcap/foundation-logger';

const unsubscribe = addGlobalLogReporter({
  log: ({ type, tag, args }) => {
    if (type !== 'error') return;
    const error = args.find((a) => a instanceof Error);
    error
      ? Sentry.captureException(error, { tags: { logger: tag } })
      : Sentry.captureMessage(`${tag}: ${String(args[0])}`, { level: 'error' });
  },
});

// Remove the reporter when no longer needed:
unsubscribe();
```

Logged arguments can hold credentials or personal and business data, so avoid forwarding them to a third-party service. `setupErrorMonitoring` from `@genesislcap/foundation-utils` wires this up and sends only log messages and exceptions.

The reporter registry is stored on `globalThis` via `Symbol.for`, so one registration covers every runtime copy of this package that uses the same registry version. A copy built against an older registry shape keeps its own registry rather than breaking this one. Child loggers (`withTag`, `withScope`, `withDefaults`, `create`) are covered too. A reporter that throws is reported on the console instead of breaking the log call, and a logger created with the reporter in its own `reporters` keeps it after unsubscribing.

## Installation

Add the package to your `package.json` dependencies. After changing dependencies, run `npm run bootstrap` (or your project's equivalent). See [package.json basics](https://learn.genesis.global/secure/web/basics/package-json-basics/) for more information.

```json
{
  "dependencies": {
    "@genesislcap/foundation-logger": "latest"
  }
}
```

## License

Note: this project provides front-end dependencies and uses licensed components listed in the next section; thus, licenses for those components are required during development. Contact [Genesis Global](https://genesis.global/contact-us/) for more details.

### Licensed components

Genesis low-code platform

---
_Source: https://npm.io/package/@genesislcap/foundation-logger · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
