ostrio:loggermongo

v0.0.7Published 9 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

Meteor Mongo adapter for ostrio:logger

Simply store application logs into MongoDB within ostrio:logger package

Installation:

meteor add ostrio:loggermongo

Usage

Log [Server & Client]
1/*
2  message {String} - Any text message
3  data    {Object} - [optional] Any additional info as object
4  userId  {String} - [optional] Current user id
5 */
6Meteor.log.info(message, data, userId);
7Meteor.log.debug(message, data, userId);
8Meteor.log.error(message, data, userId);
9Meteor.log.fatal(message, data, userId);
10Meteor.log.warn(message, data, userId);
11Meteor.log.trace(message, data, userId);
12Meteor.log._(message, data, userId); //--> Shortcut for logging without message, e.g.: simple plain log
Collection

All logs will be available in ostrioMongoLogger collection, as next object:

1doc =
2  userId: String             # UserID if Log was submitted
3                             # in association with some user
4                             #
5  date: Date                 # Log time as Date object
6  timestamp: String          # Date object as string - (+t).toString()
7  level: String              # Log level
8  message: String            # Passed message
9  additional: Object         # Passed object
Activate and set adapter settings [Server & Client]
1Meteor.log.rule('Mongo', 
2{
3  enable: true,
4  filter: ['*'], /* Filters: 'ERROR', 'FATAL', 'WARN', 'DEBUG', 'INFO', '*' */
5  client: false, /* This allows to call, but not execute on Client */
6  server: true   /* Calls from client will be executed on Server */
7});