0.2.2 • Published 2 years ago

custom-logger-service v0.2.2

Weekly downloads
3
License
MIT
Repository
github
Last release
2 years ago

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

VS Code Shell Git GitHub Node.JS TypeScript JavaScript

Features

  • Compatible with both TypeScript and ES6 (I recommend to use TypeScript)

Getting started

Requirements

Installation

You have two options to install this repository. 1. By adding the dependency to your package.json file.

{
  "dependencies": {
    "custom-logger-service": "^0.2.2"
  }
}
# Install dependencies
# NPM
npm install
# or Yarn
yarn
  1. 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

EventColor
debuggrey
errorred
infoblue
loggreen
warnyellow

People

Author - Isidro A. Lopez G.

License

CustomLoggerService is under MIT license.


© Copyright 2019-present - CustomLoggerService by Isidro A. López G.