-
-
Save savagematt/25e8bec79eb3ef270722be9a477e8698 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
// Quick and easy | |
// add correlation id to app logs | |
// set correlation id in test steps (but ignore user-specified correlation id in production) | |
log.anonymised({some:"log"}); | |
log.sensitive(() => {some:"log"}); | |
log.sensitive({some:"log"}); | |
// Maybe inconvenient, and maybe we don't need it | |
// Stateful thread locals would be better, but hey ho | |
const block = log.block("some block") | |
const subblock = block.block("some sub-block") | |
{ | |
rootId: 1, // in Log, from request scope | |
parentId: 1, // created by block() | |
id: 1, // automatic | |
} | |
{ | |
rootId: 1, // in Log, from request scope | |
parentId: 1, // created by block() | |
id: 2, // automatic | |
type: "block", | |
message: "some title" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment