mui / mui/material-ui

[all components][RFC] Refine logging strategy

Open
#21,979 2 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

discussion ready to take RFC scope: all components
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Context

This is a follow-up on #15343. Looking at the components (under /packages/*), we can count the following usage frequency of the different logging methods:

  • console.error() x69
  • console.warn() x25

Historically, React used to use console.warn(). It was changed in https://github.com/facebook/react/pull/3440 to benefit from the stack trace of console.error(). But fast forward to 2020, Chrome dev tools now support stack trace for console.warn() too. Proof:

Capture d’écran 2020-07-28 à 13 29 31
Problem

It doesn't seem that there is any rule or convention around when to use error over warn. Do we have an improvement opportunity here? Could we use it as leverage to help developers that need to prioritize which problem they should focus on first?

Proposal

What do you think of:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by auditing the console.error() and console.warn() usages under /packages/* against the proposed severity guidelines and referenced examples. Done would be an agreed logging convention and a concrete, reviewed plan for applying it across components; the issue names no target file or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.