Mirror of https://github.com/roostorg/coop github.com/roostorg/coop
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 557ff54b2b435e5f1e789c6a8a4e1bebf2d7deb6 24 lines 779 B view raw
1/* eslint-disable no-console */ 2import { jsonStringify } from './encoding.js'; 3 4// These helpers are only intended to be used when a SafeTracer is not available, e.g. during app startup before it has been initialized 5 6export function logErrorJson(m: { error: unknown; message?: string }) { 7 // Serialize error objects properly since they don't have enumerable properties 8 const serialized = { 9 ...m, 10 error: m.error instanceof Error 11 ? { 12 name: m.error.name, 13 message: m.error.message, 14 stack: m.error.stack, 15 ...(m.error as unknown as Record<string, unknown>) 16 } 17 : m.error 18 }; 19 console.error(jsonStringify(serialized)); 20} 21 22export function logJson(message: string) { 23 console.log(jsonStringify({ message })); 24}