ArangoDB 3.12 Product Release Announcement! Read the blog for details. Read Blog

Vector-5

Foxx console – Logging and querying console messages

Estimated reading time: 1 minutes

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.

Picture of Alan Plum
March 18, 2015 ,

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.

Leave a Comment