Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

i have initialized the logger like in the docs: https://atmospherejs.com/ostrio/logger with a transport to mongodb: https://atmospherejs.com/ostrio/loggermongo#initialization-isomorphic

import { Logger } from 'meteor/ostrio:logger';
import { LoggerMongo } from 'meteor/ostrio:loggermongo';

export const idLogger = new IdLogger();

export function addMongoDbLogging(idLogger, filters) {
  (new LoggerMongo(idLogger , {
    collection: AppLogs,
  })).enable({
    enable: true,
    filter: filters,
    client: true,
    server: true,
  });
}

The code lies is in the imports directory And the call to is in the server directory during meteor startup.

if(Meteor.isServer) {
  initLogger(); // calls addMongoDbLogging();
}

On The server logging works with no problems. All logs are written in the AppLogs Collection. But when i try to log something from the client... nothing happens.

Same behavior is for other transports like console. See: https://atmospherejs.com/ostrio/loggerconsole

Serverside all logs show up in my console. Client logs are not shown on neither server or client consoles.

Can someone tell me what's wrong here?

Update: It could be that the server/startup is not the right place for isomorphic code. Where should this be put?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
224 views
Welcome To Ask or Share your Answers For Others

1 Answer

Ok i found the problem.

It was the location of the code.

It has to be done in the /lib folder.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...