Socket
Socket
Sign inDemoInstall

node-ez-logger

Package Overview
Dependencies
1
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    node-ez-logger

Simple logger module for node.js


Version published
Weekly downloads
0
Maintainers
1
Install size
22.8 kB
Created
Weekly downloads
 

Readme

Source

Node EZ Logger

Simple logging module for node.js

  • Introduction
  • Usage
  • Configuration

Introduction

This module is writing log messages to the console and to files in the log folder.

Usage

Install

Install the package with NPM

npm install node-ez-logger

Require

In your script file include the module

const logger = require('node-ez-logger');

Use

In your code you can log with info(), warning(), error() or debug() methods

logger.info('info message in the log');
logger.warning('warning message in the log');
logger.error('error message in the log');
logger.debug('debug message in the log');

Configuration

You have the possibility to change the path, where the file will be placed, and the format of the date in the logfiles and in the console.

Date Format

logger.config.dateFormat(format: string): void

The timestamp will be written in this format to the console and the logfile. The date format will be parsed by the [node-date-parser](https://www.npmjs.com/package/node-date-parser) module. Default value is: ``Y-m-d H:i:s,V``

logger.config.dateFormat('Y-m-d H:i:s,V');

Log Path

logger.config.logPath(path: string): void

You can specify a different logging path if you need to. By default the files will be created in the logs folder in the same directory where your main file is running.

> Note: You only have to provide a path! If this path doesn't exist, the script will create it for you.
logger.config.logPath('custompath/logs');

Keywords

FAQs

Last updated on 14 Aug 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc