@egomobile/mongo-log
v1.0.0
Published
Extension for js-log, that writes to Mongo databases.
Downloads
23
Readme
@egomobile/mongo-log
A middleware for js-log, which writes logs to a Mongo database, using node-mongo.
Install
Execute the following command from your project folder, where your package.json
file is stored:
npm install --save @egomobile/mongo-log
The following modules are defined in peerDependencies and have to be installed manually:
Usage
import log, {
consoleLogger as useConsoleLogger,
useFallback,
useMongoLogger,
} from "@egomobile/mongo-log";
// reset the logger to configure it from scratch
log.reset();
// use mongo logger as first middleware and console logger as a fallback
log.use(useFallback(useMongoLogger(), useConsoleLogger()));
log("foo"); // default: debug
log.debug("foo"); // debug
log.error("foo"); // error
log.warn("foo"); // warning
log.info("foo"); // information
log.trace("foo"); // trace
Documentation
The API documentation can be found here.