New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

console-files

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

console-files

Simple package to handle console output to files

latest
Source
npmnpm
Version
2.3.1
Version published
Maintainers
1
Created
Source

console-files

Simple Node.js package to write application outputs to files.

It works as a default JavaScript Console object, but with special handlers for .log and .error methods, saving output to configured files.

It also treats application fatal errors (uncaughtException), appending error message to file before exiting process.

Using

npm i --save console-files
const logger = require('console-files')

/*
Do the stuff
*/

logger.log('Hello console-files!')

/*
More work to do
*/

logger.error(new Error('Keep calm, it is just a test ;)'))

Configuration

It's configurable through the following environment variables:

Environment variableMethodDefault
LOGGER_OUTPUT.log./logger.out
LOGGER_ERRORS.error./logger.err
LOGGER_FATAL_ERRORS-./_stderr
LOGGER_SKIP_FATAL--

Development and production

console-files checks the NODE_ENV to work differently for production and development modes:

const devMode = process.env.NODE_ENV !== 'production'
  • On dev mode it'll output to default console, unless the LOGGER_OUTPUT or LOGGER_FATAL_ERRORS env variable is explicitly set;

  • On production mode it'll output only to files;

Keywords

console

FAQs

Package last updated on 14 Jun 2019

Did you know?

Socket

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