Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redux-cli-logger

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

redux-cli-logger

Redux logger for a node environment

  • 2.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
decreased by-35.67%
Maintainers
1
Weekly downloads
 
Created
Source

redux-cli-logger

A redux logger for command-line environments (node.js)

No innovations here, just a logger middleware for redux that will write all redux actions and state changes to the node.js console.

Configuration and output format inspired by redux-logger

redux-node-logger screenshot

Installation

npm install --save-dev redux-cli-logger

Usage

redux-cli-logger must be called as a function before being utilized as middleware. This allows passing in options to overwrite all colors and arrow icons, as well as a predicate that functions like that in redux-logger. Here's what a simple configureStore function might look like:

import reducer from '../reducers'
import createCLILogger from 'redux-cli-logger'

const middleware = [
  // your middleware here
]

if (process.env.NODE_ENV === 'development') {
  const loggerOptions = {
    predicate: (getState, action) => !action.MONITOR_ACTION
  }
  const logger = createCLILogger(loggerOptions)
  middleware.push(logger)
}

const enhancer = compose(
  applyMiddleware(...middleware)
  // optionally, electron-enhancer, redux-loop, etc.
)

const initialState = {}
const store = createStore(reducer, initialState, enhancer)

Configuration

The options object has overridable defaults that look like this:

{
  downArrow: '▼',
  rightArrow: '▶',
  messageColor: 'bright-yellow',
  prevColor: 'grey',
  actionColor: 'bright-blue',
  nextColor: 'green',
  log: console.log,
  // when non-null, only prints if predicate(getState, action) is truthy
  predicate: null,
  // useful to trim parts of the state atom that are too verbose
  stateTransformer: (state) => state,
  // useful to censor private messages (containing password, etc.)
  actionTransformer: (action) => action,
}

Keywords

FAQs

Package last updated on 29 Jan 2018

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