Coder Social home page Coder Social logo

redux-node-logger's Introduction

#Redux-Node-Logger

A Redux logger for node environments

redux-node-logger screenshot

Install

npm install --sav-dev redux-node-logger

The Gist

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

Usage

redux-node-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

function configureStore() {
  //other conditions like client etc
  } else if (SERVER && DEVELOPMENT) {

    const createNodeLogger = require('redux-node-logger');
    finalCreateStore = compose(
      applyMiddleware(promiseMiddleware, createNodeLogger({/* an options object */})),
      createStore
    );

  }

  return finalCreateStore(rootReducer);
}

Options Object

The option object has overridable defaults that look like this:

  {
    downArrow: '▼',
    rightArrow: '▶',
    messageColor: 'bright-yellow',
    prevColor: 'grey',
    actionColor: 'bright-blue',
    nextColor: 'green',
    predicate: ''
  }

###immutable works fine because it converts to POJO on JSON.stringify

###Source uses renderkid to output color and formatting. Doesn't seem to support JSON.stringify(obj, null, 4) for instance. Anyhow, not much to it really. Feel free to look in on createNodeLogger.js and build something more to your needs

###Webpack you might need to add

plugins: [
  new webpack.IgnorePlugin(/renderkid/),
]

to your config

redux-node-logger's People

Contributors

low-ghost avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.