Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lloydjatkinson/ebb9545f63a6664d37d06392010e604b to your computer and use it in GitHub Desktop.
Save lloydjatkinson/ebb9545f63a6664d37d06392010e604b to your computer and use it in GitHub Desktop.
interface Logger {
log(message: string, context?: Record<string, unknown>): void;
logError(message: string, context: Record<string, unknown>): void;
}
const thing: Logger = {
log (message: string, context?: Record<string, unknown>) {
console.log(message, JSON.stringify(context, null, 4));
},
logError (message: string, context?: Record<string, unknown>) {
console.error(message, JSON.stringify(context, null, 4));
},
}
thing.logError("unable to make pdf", { file: 'test.pdf', date: 'today', etc: 100 })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment