Skip to content

Commit

Permalink
v2.0.2
Browse files Browse the repository at this point in the history
 - Compatibility with `[email protected]`
 - Dependencies update
 - Remove carriage return from base formatting (`\r\n` --> `\n`)
 - Better tests
  • Loading branch information
dr-dimitru committed Oct 20, 2017
1 parent 1997bb7 commit c22663e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 53 deletions.
47 changes: 19 additions & 28 deletions .versions
Original file line number Diff line number Diff line change
@@ -1,52 +1,43 @@
[email protected].6
babel-compiler@6.19.4
[email protected].9
babel-compiler@6.20.0
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected].0
ddp-client@2.0.0
[email protected].1
ddp-client@2.1.3
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected].1
[email protected].3
[email protected]
[email protected]
[email protected]
[email protected].13
[email protected].14
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
local-test:ostrio:[email protected]
local-test:ostrio:[email protected]
[email protected]
[email protected].0
minimongo@1.2.1
modules@0.9.2
[email protected].2
minimongo@1.3.2
modules@0.10.0
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
ostrio:[email protected].3
ostrio:[email protected].1
promise@0.8.9
ostrio:[email protected].4
ostrio:[email protected].2
promise@0.9.0
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected].17
[email protected].19
[email protected]
34 changes: 12 additions & 22 deletions loggermongo-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,62 +10,52 @@ if (Meteor.isServer) {
mongoLogger.collection.remove({});
}

Tinytest.addAsync('LoggerMessage Instance', (test, done) => {
Tinytest.add('LoggerMessage Instance', (test) => {
test.instanceOf(log.info('This is message "info"', {data: 'Sample data "info"'}, 'userId "info"'), LoggerMessage);
test.instanceOf(log.debug('This is message "debug"', {data: 'Sample data "debug"'}, 'userId "debug"'), LoggerMessage);
test.instanceOf(log.error('This is message "error"', {data: 'Sample data "error"'}, 'userId "error"'), LoggerMessage);
test.instanceOf(log.fatal('This is message "fatal"', {data: 'Sample data "fatal"'}, 'userId "fatal"'), LoggerMessage);
test.instanceOf(log.warn('This is message "warn"', {data: 'Sample data "warn"'}, 'userId "warn"'), LoggerMessage);
test.instanceOf(log.trace('This is message "trace"', {data: 'Sample data "trace"'}, 'userId "trace"'), LoggerMessage);
test.instanceOf(log._('This is message "_"', {data: 'Sample data "_"'}, 'userId "_"'), LoggerMessage);

done();
});

Tinytest.addAsync('LoggerMessage#toString', (test, done) => {
test.equal(log.info('This is message "info"', {data: 'Sample data "info"'}, 'userId "info"').toString(), '[This is message "info"] \r\nLevel: INFO; \r\nDetails: {"data":"Sample data \\"info\\""}; \r\nUserId: userId "info";');
test.equal(log.debug('This is message "debug"', {data: 'Sample data "debug"'}, 'userId "debug"').toString(), '[This is message "debug"] \r\nLevel: DEBUG; \r\nDetails: {"data":"Sample data \\"debug\\""}; \r\nUserId: userId "debug";');
test.equal(log.error('This is message "error"', {data: 'Sample data "error"'}, 'userId "error"').toString(), '[This is message "error"] \r\nLevel: ERROR; \r\nDetails: {"data":"Sample data \\"error\\""}; \r\nUserId: userId "error";');
test.equal(log.fatal('This is message "fatal"', {data: 'Sample data "fatal"'}, 'userId "fatal"').toString(), '[This is message "fatal"] \r\nLevel: FATAL; \r\nDetails: {"data":"Sample data \\"fatal\\""}; \r\nUserId: userId "fatal";');
test.equal(log.warn('This is message "warn"', {data: 'Sample data "warn"'}, 'userId "warn"').toString(), '[This is message "warn"] \r\nLevel: WARN; \r\nDetails: {"data":"Sample data \\"warn\\""}; \r\nUserId: userId "warn";');
test.equal(log._('This is message "_"', {data: 'Sample data "_"'}, 'userId "_"').toString(), '[This is message "_"] \r\nLevel: LOG; \r\nDetails: {"data":"Sample data \\"_\\""}; \r\nUserId: userId "_";');

done();
Tinytest.add('LoggerMessage#toString', (test) => {
test.equal(log.info('This is message "info"', {data: 'Sample data "info"'}, 'userId "info"').toString(), '[This is message "info"] \nLevel: INFO; \nDetails: {"data":"Sample data \\"info\\""}; \nUserId: userId "info";');
test.equal(log.debug('This is message "debug"', {data: 'Sample data "debug"'}, 'userId "debug"').toString(), '[This is message "debug"] \nLevel: DEBUG; \nDetails: {"data":"Sample data \\"debug\\""}; \nUserId: userId "debug";');
test.equal(log.error('This is message "error"', {data: 'Sample data "error"'}, 'userId "error"').toString(), '[This is message "error"] \nLevel: ERROR; \nDetails: {"data":"Sample data \\"error\\""}; \nUserId: userId "error";');
test.equal(log.fatal('This is message "fatal"', {data: 'Sample data "fatal"'}, 'userId "fatal"').toString(), '[This is message "fatal"] \nLevel: FATAL; \nDetails: {"data":"Sample data \\"fatal\\""}; \nUserId: userId "fatal";');
test.equal(log.warn('This is message "warn"', {data: 'Sample data "warn"'}, 'userId "warn"').toString(), '[This is message "warn"] \nLevel: WARN; \nDetails: {"data":"Sample data \\"warn\\""}; \nUserId: userId "warn";');
test.equal(log._('This is message "_"', {data: 'Sample data "_"'}, 'userId "_"').toString(), '[This is message "_"] \nLevel: LOG; \nDetails: {"data":"Sample data \\"_\\""}; \nUserId: userId "_";');
});

Tinytest.addAsync('Throw', (test, done) => {
Tinytest.add('Throw', (test) => {
try {
throw log.fatal('This is message "fatal"', {data: 'Sample data "fatal"'}, 'userId "fatal"');
} catch (e) {
test.instanceOf(e, LoggerMessage);
test.equal(e.level, 'FATAL');
test.equal(e.toString(), '[This is message "fatal"] \r\nLevel: FATAL; \r\nDetails: {"data":"Sample data \\"fatal\\""}; \r\nUserId: userId "fatal";');
test.equal(e.toString(), '[This is message "fatal"] \nLevel: FATAL; \nDetails: {"data":"Sample data \\"fatal\\""}; \nUserId: userId "fatal";');
}

done();
});

Tinytest.addAsync('Log a Number', (test, done) => {
Tinytest.add('Log a Number', (test) => {
test.instanceOf(log.info(10, {data: 10}, 10), LoggerMessage);
test.instanceOf(log.debug(20, {data: 20}, 20), LoggerMessage);
test.instanceOf(log.error(30, {data: 30}, 30), LoggerMessage);
test.instanceOf(log.fatal(40, {data: 40}, 40), LoggerMessage);
test.instanceOf(log.warn(50, {data: 50}, 50), LoggerMessage);
test.instanceOf(log.trace(60, {data: 60}, 60), LoggerMessage);
test.instanceOf(log._(70, {data: 70}, 70), LoggerMessage);

done();
});

Tinytest.addAsync('Trace', (test, done) => {
Tinytest.add('Trace', (test) => {
if (Meteor.isServer) {
test.isTrue(_.has(log.trace(602, {data: 602}, 602).details, 'stackTrace'));
test.isTrue(_.has(log.trace(602, {data: 602}, 602).data, 'stackTrace'));
} else {
test.isTrue(true);
}

done();
});

Tinytest.addAsync('Check written data, without {data} [SERVER]', (test, done) => {
Expand Down
6 changes: 3 additions & 3 deletions package.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package.describe({
name: 'ostrio:loggermongo',
version: '2.0.1',
version: '2.0.2',
summary: 'Logging: Store application\'s logs messages in MongoDB (Server & Client support)',
git: 'https://github.com/VeliovGroup/Meteor-logger-mongo',
documentation: 'README.md'
Expand All @@ -9,12 +9,12 @@ Package.describe({
Package.onUse(function(api) {
api.versionsFrom('1.4');
api.use('mongo', 'server');
api.use(['mongo', 'ecmascript', 'check', 'underscore', 'ostrio:[email protected].3'], ['client', 'server']);
api.use(['mongo', 'ecmascript', 'check', 'underscore', 'ostrio:[email protected].4'], ['client', 'server']);
api.mainModule('loggermongo.js', ['client', 'server']);
});

Package.onTest(function(api) {
api.use('tinytest');
api.use(['ecmascript', 'underscore', 'ostrio:[email protected].3', 'ostrio:[email protected].1']);
api.use(['ecmascript', 'underscore', 'ostrio:[email protected].4', 'ostrio:[email protected].2']);
api.addFiles('loggermongo-tests.js');
});

0 comments on commit c22663e

Please sign in to comment.