Skip to content

Instantly share code, notes, and snippets.

@savagematt
Created March 21, 2019 09:24
Show Gist options
  • Save savagematt/25e8bec79eb3ef270722be9a477e8698 to your computer and use it in GitHub Desktop.
Save savagematt/25e8bec79eb3ef270722be9a477e8698 to your computer and use it in GitHub Desktop.
// 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