New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

alien-node-winston-utils

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alien-node-winston-utils

Helper functions for Winston logging on NodeJS

  • 0.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18
decreased by-10%
Maintainers
1
Weekly downloads
 
Created
Source

alien-node-winston-utils

Helper functions for Winston logging on NodeJS. The functions are pure and curried with Ramda.

Build Status Coverage Status npm version Dependency Status

Install

$ npm install alien-node-winston-utils --save

Run the specs

$ npm test

Usage


// Example config file in Node
var loggerUtils = require('alien-node-winston-utils');

// ...

  logging : {
    winston : {
      transports : [
        {
          name          : 'console',
          level         : 'debug',
          timestamp     : loggerUtils.getDateString,
          colorize      : true,
          transportType : 'console'
        },
        {
          name             : 'file',
          level            : 'error',
          timestamp        : loggerUtils.getDateString,
          colorize         : true,
          transportType    : 'file',
          filename         : 'logs/activity.log',
          json             : false, // required for formatter to work
          formatter        : loggerUtils.getFormatter,
          handleExceptions : true,
          datePattern      : '.yyyy-MM-dd' // dictates how logs are rotated - more specific pattern rotates more often
        }
      ],
      strategies : {
        console : winston.transports.Console,
        file    : winston.transports.DailyRotateFile
      }
    }
  },
  
// ...

Methods

getDateString

This is just a helper for Winston's timestamp option, which just returns new Date().toString()

getFormatter

This is the primary use of this library. As seen in the usage above, use it as a pointer reference. As seen in the TODO below, we will want to make this a true getter which accepts a template param. But for now, it works just fine.

TODO

  • Currently there is only one formatter. Allowing it to accept a decorator would be considerate.

Keywords

FAQs

Package last updated on 13 Sep 2023

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc