Skip to content

Commit

Permalink
Enable logActions by default and not deepClone state for actions
Browse files Browse the repository at this point in the history
  • Loading branch information
deini committed Apr 21, 2020
1 parent 3881bbd commit 6542765
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/guide/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const logger = createLogger({
// Same as mutationTransformer but for actions
return action.type
},
logActions: false, // Log Actions
logActions: true, // Log Actions
logMutations: true, // Log mutations
logger: console, // implementation of the `console` API, default `console`
})
Expand Down
6 changes: 2 additions & 4 deletions src/plugins/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default function createLogger ({
mutationTransformer = mut => mut,
actionFilter = (action, state) => true,
actionTransformer = act => act,
logActions = false,
logActions = true,
logMutations = true,
logger = console
} = {}) {
Expand Down Expand Up @@ -42,9 +42,7 @@ export default function createLogger ({

if (logActions) {
store.subscribeAction((action, state) => {
const currentState = deepCopy(state)

if (actionFilter(action, currentState)) {
if (actionFilter(action, state)) {
const formattedTime = getFormattedTime()
const formattedAction = actionTransformer(action)
const message = `action ${action.type}${formattedTime}`
Expand Down

0 comments on commit 6542765

Please sign in to comment.