custom-logger-service
v0.2.2
Published
Custom Logger for Apps and API Services
Downloads
7
Maintainers
Readme
Custom Logger for Apps and API Services
Description
CUstomLoggerService is an utility service that helps you to display debugging, error, informative, log, and warning messages. This tool is made to be used in Node.js, which allows you to easily build efficient, scalable applications. It uses modern JavaScript, is built with TypeScript and bring best JavaScript concepts.
Technology Stack
Features
- Compatible with both TypeScript and ES6 (I recommend to use TypeScript)
Getting started
Requirements
- NodeJS v8+
- NPM v6+ or yarn v1.17+
- custom-console-colors
Installation
You have two options to install this repository.
By adding the dependency to your
package.json
file.{ "dependencies": { "custom-logger-service": "^0.2.2" } }
# Install dependencies # NPM npm install # or Yarn yarn
By using a package manager
# NPM npm install --save custom-console-color # or Yarn yarn add @ialopezg/core
Usage
Initialization
Default options
const { LoggerService } = require('custom-logger-service')
// With default options
const logger = new Logger();
No options nor styles
const logger = new Logger({
useFormat: false,
});
No options and default format
const config: FormatOptions = {
useFormat: true,
useAppName: false,
usePID: false,
useContext: false,
useEvent: false,
useTimestamp: false,
usePadding: false,
};
const logger = new LoggerService(config);
Usage
const message = 'Hello World!';
logger.debug(message);
logger.error(message);
logger.info(message);
logger.log(message);
logger.warn(message);
Examples
Available Colors and Styles
| Event | Color | | ----- | ------- | | debug | grey | | error | red | | info | blue | | log | green | | warn | yellow |
People
Author - Isidro A. Lopez G.
License
CustomLoggerService is under MIT license.
© Copyright 2019-present - CustomLoggerService by Isidro A. López G.