Another logger in JS. This one offers a console.log-like API and formatting, colored lines and timestamps (or not if desired), all that with 0 dependencies.

Commit 5f117798

5f1177989f21Merged

Maxence Lecanu <[email protected]> · 4 months ago · 7 files · +1 added · ~6 modified

Description

Merge pull request #55 from hexablob/feat/child-loggers-dx

feat: child loggers, structured meta, Error serialization, timers, TTY-aware color

Details

Commit
5f1177989f21
Parent
c088f6c4b226
Merge parent
024e1300bf2d

lib/errors.tsaddedView file

1+export interface SerializedError {
2+ name: string;
3+ message: string;
4+ stack?: string | undefined;
5+}
6+
7+export function serializeError(err: unknown): SerializedError | undefined {
8+ if (!(err instanceof Error)) return undefined;
9+ return {
10+ name: err.name,
11+ message: err.message,
12+ stack: err.stack,
13+ };
14+}