Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implemented redux-logger given an environmental variable #61

Merged
merged 1 commit into from
Jul 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion lib/watermill.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
'use strict'

const { createStore, applyMiddleware } = require('redux')
const createLogger = require('redux-logger')
const thunk = require('redux-thunk').default
const rootReducer = require('./reducers')

const createSagaMW = require('redux-saga').default
const sagaMW = createSagaMW()
const logger = createLogger()

const store = createStore(rootReducer, applyMiddleware(thunk, sagaMW))
// default middlewares
let middlewares = [thunk, sagaMW]

// if Environmental variable REDUX_LOGGER is 1 then...
const loggerEnv = process.env.REDUX_LOGGER
// for now call REDUX_LOGGER=1 before executing a pipeline
// REDUX_LOGGER=1 node pipeline.js
if (loggerEnv === '1') {
middlewares.push(logger)
}

const store = createStore(rootReducer, applyMiddleware(...middlewares))

const rootSaga = require('./sagas')
sagaMW.run(rootSaga)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"isstream": "^0.1.2",
"istanbul": "^0.4.4",
"mocha": "^2.5.3",
"redux-logger": "^2.6.1",
"redux-logger": "^2.10.2",
"request": "^2.72.0",
"split": "^1.0.0",
"stream-assert": "^2.0.3",
Expand Down