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

(#1513) Replace console with client-logger and node-logger packages #2347

Merged
merged 10 commits into from
Nov 25, 2017

Conversation

dangreenisrael
Copy link
Member

@dangreenisrael dangreenisrael commented Nov 22, 2017

Issue: #1513

What I did

Added a logger package containing a logger to be use in the browser and another to be used in node.

Note: This is for work in progress. Any feedback is more than welcome.

How to test

Is this testable with jest or storyshots?
Jest

Does this need a new example in the kitchen sink apps?
No

Does this need an update to the documentation?
Yes, it will need to be documented for add-on developers

If your answer is yes to any of these, please make sure to include it in your PR.

Screenshots

Node

screen shot 2017-11-23 at 11 24 28 am

Browser

screen shot 2017-11-24 at 10 24 27 pm

@codecov
Copy link

codecov bot commented Nov 22, 2017

Codecov Report

Merging #2347 into release/3.3 will increase coverage by 0.09%.
The diff coverage is 60%.

Impacted file tree graph

@@               Coverage Diff               @@
##           release/3.3    #2347      +/-   ##
===============================================
+ Coverage        21.48%   21.58%   +0.09%     
===============================================
  Files              337      339       +2     
  Lines             7098     7107       +9     
  Branches           875      880       +5     
===============================================
+ Hits              1525     1534       +9     
+ Misses            4934     4915      -19     
- Partials           639      658      +19
Impacted Files Coverage Δ
app/react/src/client/preview/render.js 0% <ø> (ø) ⬆️
app/react/src/server/config.js 0% <ø> (ø) ⬆️
app/react/src/server/babel_config.js 76.66% <ø> (ø) ⬆️
app/react/src/server/index.js 0% <0%> (ø) ⬆️
app/react/src/server/build.js 0% <0%> (ø) ⬆️
app/react/src/client/preview/client_api.js 85.71% <0%> (ø) ⬆️
lib/client-logger/src/index.js 100% <100%> (ø)
lib/node-logger/src/index.js 100% <100%> (ø)
app/vue/src/server/config/babel.js 0% <0%> (-100%) ⬇️
lib/ui/src/modules/ui/components/layout/usplit.js 22.58% <0%> (ø) ⬆️
... and 47 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7c5c00c...a34e709. Read the comment docs.

@dangreenisrael
Copy link
Member Author

dangreenisrael commented Nov 22, 2017

There seems to be some sort of issue with the build step of the integration tests that is happening on circle but not local for me 😕

It ends with

Storybook started on => http://localhost:9009/

Step was canceled

@Hypnosphi
Copy link
Member

This is for app/react only

Why?

@@ -3,14 +3,13 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { stripIndents } from 'common-tags';
import logger from 'npmlog';
Copy link
Member

Choose a reason for hiding this comment

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

Does it work on client?

Copy link
Member Author

@dangreenisrael dangreenisrael Nov 22, 2017

Choose a reason for hiding this comment

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

(facepalm) It was late when I was working on this. Thanks @Hypnosphi. I was indeed trying to use a node logger in a browser environment.

@dangreenisrael
Copy link
Member Author

I just wanted to make sure that this was what the team wanted, before making the change throughout the ecosystem.

@dangreenisrael
Copy link
Member Author

dangreenisrael commented Nov 22, 2017

@Hypnosphi @ndelangen Do you guys prefer to import npmlog directly into files, or have a storybook-client-logger and storybook-node-logger that we keep in a central location and use throughout the mono-repo?

@dangreenisrael dangreenisrael self-assigned this Nov 22, 2017
@dangreenisrael dangreenisrael changed the title (#1513) Replace console with npmlog in app/react (#1513) Replace console with npmlog Nov 22, 2017
@ndelangen
Copy link
Member

@Hypnosphi @ndelangen Do you guys prefer to import npmlog directly into files, or have a storybook-client-logger and storybook-node-logger that we keep in a central location and use throughout the mono-repo?

Sounds like a good thing indeed, if we want to change logger, we can do it in a central location 👍

@ndelangen
Copy link
Member

@dangreenisrael I usually take some screenshots of the changes just before opening up the PR, so I can post them.

At least for me, it helps visualise and remember what the PR is about, what it's doing.

👍

@dangreenisrael dangreenisrael changed the title (#1513) Replace console with npmlog (#1513) Replace console with logger package Nov 23, 2017
@dangreenisrael dangreenisrael changed the title (#1513) Replace console with logger package (#1513) [Work in Progress] Replace console with logger package Nov 23, 2017
@Hypnosphi
Copy link
Member

@dangreenisrael feel free to merge if you think it's ready

@dangreenisrael dangreenisrael changed the title (#1513) [Work in Progress] Replace console with logger package (#1513) Replace console with client-logger and node-logger packages Nov 25, 2017
@dangreenisrael dangreenisrael merged commit ba115e6 into release/3.3 Nov 25, 2017
@dangreenisrael dangreenisrael deleted the Replace-console.log-with-npmlog branch November 25, 2017 18:04
@Hypnosphi
Copy link
Member

As you wish. I think there’s a sense in adding this to all the packages that log anything

@dangreenisrael
Copy link
Member Author

@Hypnosphi I think I would prefer to do each platform in its own, smaller PR. I think that keeping PRs small makes things more manageable, and makes it easier to track down bugs if they are introduced.

@Hypnosphi
Copy link
Member

Hypnosphi commented Nov 25, 2017

Will it be a separate PR for each addon and utility package (lib/*) as well?

@dangreenisrael
Copy link
Member Author

dangreenisrael commented Nov 25, 2017

Not all of the addons use console.log. I will probably do one PR for the each of the platforms, and one PR for the all of the addons . Also, if I run out of time doing this, I want it to be as easy as possible for someone else to takeover.

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.

3 participants