Features

Dumps

Put a value in the local dashboard instead of your terminal, as a tree, under the request it belongs to.

PeekInside.dump() is console.log for objects you want to look at. The value shows up in the local dashboard right away: on the Dumps page, and under the request (or job run) it was dumped in, as a tree that opens level by level, with the line of your code that dumped it.

import PeekInside from 'peekinside';

app.post('/checkout', async (req, res) => {
  const cart = PeekInside.dump(await loadCart(req.user), 'cart');
  // ...
});

dump() returns the value it was given, so it can wrap an expression in place: return PeekInside.dump(order). The label is optional; without one, the dump is listed by its type.

What a dump shows#

A dump keeps the value's shape and types, where console.log would print text:

  • Objects with their class (Cart, User), arrays, Maps and Sets with their sizes, Dates, errors with their message, stack, code and cause, Buffers, BigInts, symbols and functions.
  • Cycles point back to where the value was already shown ("circular: the same as $.owner"), instead of repeating forever.
  • Nothing of your code runs while a value is read: getters are listed but not called, and proxies aren't looked into.
  • Big values are cut, and the dashboard says where: 10 levels deep, 100 items per object or array, 4,000 characters per string.

The line that dumped it is shown with each dump, mapped through your source maps for TypeScript, and opens in your editor (the one chosen on an exception's Stack tab).

Where dumps show up#

Place What it shows
Dumps page Every dump, live, newest first. Filter by label, value, type or file; request:<id> and job:<id> keep one request's or job run's dumps
A request's Overview The dumps made while it was handled, opened in place
A request's Timeline When each dump happened, next to its queries, calls and log lines
A job run Dumps made during the run link to it

Only on your machine#

Dumps are for development. They go to the local dashboard only: with PeekInside Cloud, or when PeekInside isn't recording, dump() does nothing but return the value, so a dump left in your code costs nothing in production and never leaves the server.

The local hub keeps the newest 1,000 dumps of each project. At most 50 dumps a second are recorded per process (bursts of 200). Clear them from the Dumps page.