Created
July 8, 2022 14:46
-
-
Save lloydjatkinson/ebb9545f63a6664d37d06392010e604b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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