Skip to content

Commit 5ed43ff

Browse files
committed
Enable logActions by default and not deepClone state for actions
1 parent 066de7a commit 5ed43ff

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

docs/en/plugins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const logger = createLogger({
126126
// Same as mutationTransformer but for actions
127127
return action.type
128128
},
129-
logActions: false, // Log Actions
129+
logActions: true, // Log Actions
130130
logMutations: true, // Log mutations
131131
logger: console, // implementation of the `console` API, default `console`
132132
})

src/plugins/logger.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default function createLogger ({
99
mutationTransformer = mut => mut,
1010
actionFilter = (action, state) => true,
1111
actionTransformer = act => act,
12-
logActions = false,
12+
logActions = true,
1313
logMutations = true,
1414
logger = console
1515
} = {}) {
@@ -42,9 +42,7 @@ export default function createLogger ({
4242

4343
if (logActions) {
4444
store.subscribeAction((action, state) => {
45-
const currentState = deepCopy(state)
46-
47-
if (actionFilter(action, currentState)) {
45+
if (actionFilter(action, state)) {
4846
const formattedTime = getFormattedTime()
4947
const formattedAction = actionTransformer(action)
5048
const message = `action ${action.type}${formattedTime}`

0 commit comments

Comments
 (0)