Meteor Logger
Installation
The package can be installed with Meteorite.
Type inside your application directory:
$ mrt add logger
Usage
The logger supports the following log levels:
1Meteor.log.debug('some message'); 2Meteor.log.info('...'); 3Meteor.log.warning('...'); 4Meteor.log.error('...'); 5Meteor.log.throw('...'); // Will throw an exception.
This works, too:
1Meteor.log('some message'); // Equivalent to Meteor.log.info('some message') 2Meteor.log('some message', 'error'); // Equivalent to Meteor.log.error('some message')
You can set the log level like this:
1Meteor.log.setDebugLevel('info'); // or 'error', 'warn' or 'debug'. 'warn' is the default.
Translation
If you add the i18n package to your application then all messages will automatically be translated.
All the following are valid calls to the logger API:
1Meteor.log.info('someMessageId', {param: '...'}); 2Meteor.log.throw('someMessageId', {param: '...'}); 3Meteor.log('someMessageId', {param: '...'}); 4Meteor.log('someMessageId', {param: '...'}, 'warning'); 5Meteor.log('someMessageId', 'warning');
See the i18n package README for further info about message IDs, translation parameters, etc.
Questions and Feature Requests
If you have feature requests or other feedback please write to jerico.dev@gmail.com.
Contributions
Contributions are welcome! Just make a pull request and I'll definitely check it out.