fgm / filog

A fine logger package for Meteor.JS applications (client + server)
GNU General Public License v3.0
18 stars 6 forks source link

How to start? #40

Closed liu0fanyi closed 7 years ago

liu0fanyi commented 7 years ago

I try to follow these:

constructs a ClientLogger instance, passing it the strategy instance, like:

  let logger = new ClientLogger(new LeveledStrategy(
    new NullSender(),
    new ConsoleSender(),
    new MeteorClientHttpSender(Meteor.absoluteUrl('logger'))
  ));

adds processor instances to the logger instance, like:

  logger.processors.push(
    new BrowserProcessor(),
    new RoutingProcessor(),
    new MeteorUserProcessor(Meteor)
  );

is now able to log events, like:

  logger.warn("Some warning condition", { foo: "bar" });

steps

  1. meteor npm install filog --save
  2. meteor add http
  3. add up codes in client/main.js

and I can't find log anywhere...

fgm commented 7 years ago

At this point, you only send the logs to Meteor, but when the server logger part receives the logs, it has no sender to do anything with them, so it just discards them. You also need to configure a ServerLogger instance, probably with the Mongo sender to store them in the logs, or the Syslog sender to send them tou your syslog server.

liu0fanyi commented 7 years ago

@FGM Thank you for response , I will have a try

fgm commented 7 years ago

No more comment in over one month, assuming fixed.