Skip to content
Closed
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
4 changes: 4 additions & 0 deletions src/plugins/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { deepCopy } from '../util'
export default function createLogger ({
collapsed = true,
transformer = state => state,
ignored = type => false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to pass mutation object instead of type?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think passing in the entire mutation object leaves room for more flexibility.

mutationTransformer = mut => mut
} = {}) {
return store => {
Expand All @@ -14,6 +15,9 @@ export default function createLogger ({
if (typeof console === 'undefined') {
return
}
if (ignored(mutation.type)) {
return
}
const nextState = deepCopy(state)
const time = new Date()
const formattedTime = ` @ ${pad(time.getHours(), 2)}:${pad(time.getMinutes(), 2)}:${pad(time.getSeconds(), 2)}.${pad(time.getMilliseconds(), 3)}`
Expand Down