veliovgroup/Meteor-logger

Logs in Mongo

mariusrak opened this issue · 2 comments

Hi I've used examples from readme for logging in files, mogno and console. So I have this code:

import { Logger } from "meteor/ostrio:logger";
import { LoggerFile } from "meteor/ostrio:loggerfile";
import { LoggerMongo } from "meteor/ostrio:loggermongo";
import { LoggerConsole } from "meteor/ostrio:loggerconsole";
const log = new Logger();
new LoggerFile(log).enable();
new LoggerMongo(log).enable();
new LoggerConsole(log).enable();

const bound = Meteor.bindEnvironment(callback => callback());
process.on("uncaughtException", err => {
        bound(() => {
                log.error("Server Crashed!", err);
                console.error(err, err.stack);
        });
});

const originalMeteorDebug = Meteor._debug;
Meteor._debug = function(message, stack) {
        const error = new Error(message);
        error.stack = stack;
        log.error("Meteor Error!", error);
        return originalMeteorDebug.apply(this, arguments);
};

In Console I can see:

{ '0': [ 'Notes', 's', 'Create' ],
  '1': [ { label: 'fdgfdfd', meta: [Object], content: '<p>&nbsp;</p>' } ],
  '2': null }
[ERROR: Meteor Error! @ Thu Mar 07 2019 22:43:44 GMT+0000 (UTC)]
Exception while invoking method 'Remote' TypeError: Cannot read property 'ObjectClass' of undefined
    at MethodInvocation.Remote (...)
    at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1771:12)
    at DDP._CurrentMethodInvocation.withValue (packages/ddp-server/livedata_server.js:719:19)
    at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)
    at DDPServer._CurrentWriteFence.withValue (packages/ddp-server/livedata_server.js:717:46)
    at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1234:12)
    at Promise (packages/ddp-server/livedata_server.js:715:46)
    at Promise (<anonymous>)
    at Session.method (packages/ddp-server/livedata_server.js:689:23)
    at packages/ddp-server/livedata_server.js:559:43

But in mongo I have only this:
{ "_id" : "3Qj5BzFdngKDAE7F6", "userId" : null, "date" : ISODate("2019-03-07T22:43:44.137Z"), "timestamp" : 1551998624137, "level" : "ERROR", "message" : "Meteor Error!", "additional" : { } }

I'd expect same information in mongo, how can I achieve it?
Thanks.

Hello @mariusrak ,

Thank you for reporting about this, looks like this issue was already discussed in veliovgroup/Meteor-logger-mongo#23 (comment)
We will update our docs soon!

Feel free to close it in case if the issue is solved on your end.

Closed due to silence at issue owner end.
Feel free to reopen it in case if the issue still persists on your end.