blacksun1-chalk-logger
v1.0.4
Published
Simple logger that uses chalk to create a human friendly output
Downloads
3
Readme
blacksun1-chalk-logger
A pleasant readable logger for humans.
Usage
First install the package into your application
npm install --save blacksun1-chalk-logger
and then in your code
const LoggerFactory = require("blacksun1-chalk-logger").loggerFactory;
const Package = require("./package.json");
const myLogger = LoggerFactory(Package.name);
myLogger.info("I'm logging!");
or if you use Intavenous you can use the registration package to regisiter it and it's required services into your container.
const LoggerModule = require("blacksun1-chalk-logger").registrationModule;
const Package = require("./package.json");
const Intavenous = require("intavenous");
const container = Intavenous.create();
LoggerModule(container);
const myLogger = container.get("logger", Package.name);
myLogger.info("I'm logging!");
API
Exports the following:
logger
- The actual logger class. Requires constructor arguments.loggerFactory
- A factory function to create an instance of the logger class. Takes a parameter ofname
to set the name of the logger.registrationModule
- A registration module. See blacksun1/ioc-test.