veliovgroup / Meteor-logger

🧾 Meteor isomorphic logger. Store application logs in File (FS), MongoDB, or print in Console

Home Page:https://packosphere.com/ostrio/logger

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

404 Error while invoking LoggerMongo on the client side

arlen-yu opened this issue · comments

I'm having an issue:

Using the logger on the client side within a React component:

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

const log = new Logger()
new LoggerMongo(log).enable()
log.info('testing')

Gives me the following error:
Error invoking Method '1_logger_emit_Mongo': Method '1_logger_emit_Mongo' not found [404],
and no log is inserted into the DB.

Am I missing something? My Meteor version is 1.6.0.1, and logger versions are:

ostrio:logger@2.0.6
ostrio:loggerconsole@2.0.3
ostrio:loggermongo@2.0.3

On the server side, this error does not occur and I can see that the log is properly being inserted into the DB.

Hello @arlen-yu ,

Looks like you're initiating logger only on the Client, while Logger should be initiated isomorphically (e.g. on both Client and Server), for example at lib directory.

@dr-dimitru perfect, thanks!

@arlen-yu I'm glad it was quick fix :)

Please, support this project by: