{"id":18143396,"url":"https://github.com/tristanls/redux-logging-reducer","last_synced_at":"2026-05-08T13:34:03.754Z","repository":{"id":141245494,"uuid":"91737003","full_name":"tristanls/redux-logging-reducer","owner":"tristanls","description":"Logging reducer for Redux.","archived":false,"fork":false,"pushed_at":"2017-06-10T16:28:26.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-13T01:36:54.406Z","etag":null,"topics":["actions","dispatch","reducer","redux","testing"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tristanls.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-18T20:57:37.000Z","updated_at":"2017-05-18T21:00:29.000Z","dependencies_parsed_at":null,"dependency_job_id":"8a796925-33ee-40f4-9c5a-a985fd113335","html_url":"https://github.com/tristanls/redux-logging-reducer","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tristanls%2Fredux-logging-reducer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tristanls%2Fredux-logging-reducer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tristanls%2Fredux-logging-reducer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tristanls%2Fredux-logging-reducer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tristanls","download_url":"https://codeload.github.com/tristanls/redux-logging-reducer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247538522,"owners_count":20955128,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","dispatch","reducer","redux","testing"],"created_at":"2024-11-01T19:07:13.000Z","updated_at":"2026-05-08T13:33:58.722Z","avatar_url":"https://github.com/tristanls.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redux-logging-reducer\n\nAdds logging of dispatched actions to your reducer functionality storing dispatched actions in the reducer's store.\n\nNOTE: Since writing this module, I found it easier to test reducer and `redux-observable` epics separately using patterns described here: [Writing Epic Unit Tests](https://medium.com/kevin-salters-blog/writing-epic-unit-tests-bd85f05685b).\n\n## Usage\n\n```javascript\nimport { applyMiddleware, createStore } from \"redux\";\nimport { logging, log, noLog } from \"redux-logging-reducer\";\n\nimport reducer from \"./reducer\";\n\nconst middleware = [];\n\ndescribe(\"Testing actions\", () =\u003e\n{\n    let store;\n    beforeEach(() =\u003e\n        {\n            store = createStore(logging(reducer), applyMiddleware(...middleware));\n        }\n    );\n    it(\"should log dispatched action and return initial state\", () =\u003e\n        {\n            store.dispatch({type: \"MY_ACTION\"});\n            const dispatched = log(store.getState());\n            const state = noLog(store.getState());\n            expect(dispatched).toContainEqual({type: \"MY_ACTION\"});\n            expect(state).toEqual(reducer.INITIAL_STATE);\n        }\n    );\n});\n```\n\n## Documentation\n\n#### log(state, fieldName = \"@@redux-logging-reducer/log\")\n\n  * `state`: _Object_ Redux state from `store.getState()`.\n  * `fieldName`: _String_ Field name to extract log of dispatched actions from.\n  * Return: _Array_ Array of dispatched actions.\n\nExtracts the log of dispatched actions from Redux store state.\n\n#### logging(reducer, fieldName = \"@@redux-logging-reducer/log\")\n\n  * `reducer`: _Function_ Redux reducer to add logging to.\n  * `fieldName`: _String_ Field name to store log of dispatched actions in.\n  * Return: _Function_ Redux reducer that will log dispatched actions in `fieldName`.\n\nMonkey patches `reducer` to store log of dispatched actions.\n\n#### noLog(state, fieldName = \"@@redux-logging-reducer/log\")\n\n  * `state`: _Object_ Redux state from `store.getState()`.\n  * `fieldName`: _String_ Field name to remove containing dispatched actions.\n  * Return: _Object_ Redux store state without dispatched actions log.\n\nRemoved log of dispatched actions from Redux store state.\n\n## Releases\n\n[Current releases](https://github.com/tristanls/redux-logging-reducer/releases).\n\n### Policy\n\nWe follow the semantic versioning policy ([semver.org](http://semver.org/)) with a caveat:\n\n\u003e Given a version number MAJOR.MINOR.PATCH, increment the:\n\u003e\n\u003eMAJOR version when you make incompatible API changes,\u003cbr/\u003e\n\u003eMINOR version when you add functionality in a backwards-compatible manner, and\u003cbr/\u003e\n\u003ePATCH version when you make backwards-compatible bug fixes.\n\n**caveat**: Major version zero is a special case indicating development version that may make incompatible API changes without incrementing MAJOR version.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftristanls%2Fredux-logging-reducer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftristanls%2Fredux-logging-reducer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftristanls%2Fredux-logging-reducer/lists"}