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

Simplify logging middleware #40

Merged
merged 6 commits into from
May 9, 2020
Merged

Conversation

crazytoucan
Copy link
Contributor

@crazytoucan crazytoucan commented May 9, 2020

The previous version of the logging middleware was written in 2016, when Chrome default formatting options were a lot poorer and Redux workflows were a lot different. The complexity that the logging implementation brought was far too high for the marginal value it provided.

This PR removes the entire old logging implementation in favor of a single call to console.log:

    console.log(
      "%credoodle %c%s %c%o %O prevState=%O nextState=%O",
      GRAY,
      ROSE3,
      action.type,
      GRAY,
      action.payload,
      action.meta !== undefined ? action.meta : "",
      previousState,
      nextState,
    );

Additionally, the new approach should:

  • Have far less overhead at runtime when developing
  • Support better console filtering options in the debugger
  • Be generally far less noisy
  • Have less download-size overhead for those application bundles that do not properly tree shake

Example output:

Screen Shot 2020-05-09 at 3 59 34 PM

@crazytoucan crazytoucan merged commit 746a893 into master May 9, 2020
@crazytoucan crazytoucan deleted the simplify-logging-middleware branch May 9, 2020 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant