Skip to content
Pavel edited this page Oct 13, 2015 · 2 revisions

Normally, you need to use only one object in your application to get access to all Observatory features: Toolbox - swiss knife of logging and profiling, accessible via Observatory.getToolbox() both on the server and the client. Observatory has very powerful settings system that allows you to fine-tune all automatic logging and monitoring as well as set log levels with any desired granularity. You can manage these settings in your Observatory account.

Manual Logging

To log a message with specific severity call one of the following methods:

// Get the logger
var tb = Observatory.getToolbox();

tb.fatal("application failed drastically", optional_json_object, "optional module name");
tb.error("some error occurred", optional_json_object, "optional module name");
tb.warn("a warning message", optional_json_object, "optional module name");
tb.info("just for your information", optional_json_object, "optional module name");
tb.verbose("logging every single detail", optional_json_object, "optional module name");
tb.debug("some debugging stuff", optional_json_object, "optional module name");

// tracing an error, useful in try-catch blocks
tb.trace(error,"additional message about error","optional module name");

With any of these methods Observatory will automatically log user id, ip address and other relevant information useful in further log analysis.

Automatical Logging

Currently, Observatory automagically logs HTTP and DDP requests via setting corresponding options. There's more exciting stuff coming up soon: we are working on the ability to log key Meteor classes and methods without the need to write a single line of code.

Next on the list are Subscriptions (logging & profiling), Accounts and Collection methods on the client, Template lifecycle methods as well as events (extremely useful for logging and analyzing user behavior). Since automatic logging and profiling in many cases requires dynamic method overolading, you will always have full control over which options to use in your Meteor application.

Guides

Frameworks

Clone this wiki locally