1.0.1 • Published 5 years ago

forge-nodejs-logs v1.0.1

Weekly downloads
14
License
ISC
Repository
-
Last release
5 years ago

forge-nodejs-logs

Installation:

npm install forge-nodejs-logs --save

Usage:

import {ForgeLogger} from "forge-nodejs-logs";

const logger = new ForgeLogger({
  mongoUrl: "mongodb://localhost:27017/forge-logs", // optional
  appInsightKey: "your-instrumentation-key",  // optional
  console: true,
  filename: "somefile.log",  // optional
  level: "debug",
  role: "my-microservice",
  roleId: "my-microservice-1"
});

for (let i = 0; i < 100; i++) {
  logger.debug("A debug");
  logger.info("An info", { anything: "This is metadata" });
  logger.warn("A warning");
  logger.error("A terrible error");
}

const loggerContext = logger.enrich({myEnrichedData: "test"});
loggerContext.info("Another info");

setTimeout(() => logger.close(), 10000);

Also a IForgeLogger, ForgeLoggerContext and NullForgeLogger classes are exported.

1.0.1

5 years ago

1.0.0

5 years ago

1.0.0-0

5 years ago

0.5.1

7 years ago

0.5.0

8 years ago

0.4.0

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago