1.0.8 • Published 3 years ago
@lielamar/logger v1.0.8
Logger
A simple Logger for NodeJS written in TypeScript
Instalation
You can install Logger from npm js. You need to have Node installed on your machine before installing the Logger module.
$ npm install @lielamar/logger
Usage
To use the Logger module you need to create a file where you will manage your Logger from. This file should import the Logger module, create an instance of it and then export it.
const Logger = require("@lielamar/logger").default;
const logger = new Logger("Namespace", "path/to/target/folder", {
consoleLog: true,
includeObjects: true,
});
logger.info("Hello!");
logger.warn("Hello!");
logger.debug("Hello!");
logger.error("Hello!");
module.exports = logger;
and then you can use logger from any other class by requiring the previous file. if you have multiple logs happening asynchrony it's also best to await the logger to prevent duplications :)
const logger = require("./logger.js");
await logger.info("Hey from another file!");
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.