home shape

Foxx console – Logging and querying console messages

Aside from the more noticeable features, ArangoDB 2.5 also added the console object to the scope of all Foxx app modules. Unlike the object already available by importing the console module, the Foxx console logs all messages directly to the database.

In addition to allowing you to specify per-application log levels to make sure your debug messages don’t end up cluttering your production database, the API also provides useful extras like optionally logging a full stack trace for every message that is stored as a structured list of objects, making them easy to query using AQL. There’s also a number of convenience methods for querying your application’s log entries from within your Foxx code if you prefer keeping it simple.

console.time('do something');
// ... more code ...
console.time('do more stuff');
// ... even more code ...
console.timeEnd('do more stuff'); // => "do more stuff: 23ms"
// ... a little bit more ....
console.timeEnd('do something'); // => "do something: 52ms"

For more information see the chapter on the Foxx console API in the official ArangoDB documentation.

Alan Plum avatar 1418721602 92x92

Alan Plum

Alan is an experienced web developer who feels equally at home in the backend and frontend. At ArangoDB he works on everything regarding JavaScript, with a special focus on Foxx.

Get the latest tutorials, blog posts and news: