Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

feat: logger supports console.table, with console.log fallback #738

Merged

Conversation

rusackas
Copy link
Member

💔 Breaking Changes

🏆 Enhancements
Supports console.table safely :)

📜 Documentation

🐛 Bug Fix

🏠 Internal

@rusackas rusackas requested a review from a team as a code owner August 15, 2020 00:13
@vercel
Copy link

vercel bot commented Aug 15, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/superset/superset-ui/1z9dghh9q
✅ Preview: https://superset-ui-git-fork-preset-io-consoletable-support-via-logger.superset.vercel.app

@rusackas
Copy link
Member Author

Not quite sure how to unit test this, since it depends on the browser.

@rusackas rusackas requested a review from ktmud August 15, 2020 00:14
@codecov
Copy link

codecov bot commented Aug 15, 2020

Codecov Report

Merging #738 into master will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #738      +/-   ##
==========================================
+ Coverage   24.35%   24.43%   +0.07%     
==========================================
  Files         340      340              
  Lines        7637     7645       +8     
  Branches      929      935       +6     
==========================================
+ Hits         1860     1868       +8     
  Misses       5704     5704              
  Partials       73       73              
Impacted Files Coverage Δ
packages/superset-ui-core/src/utils/logging.ts 100.00% <100.00%> (ø)

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 d323ce8...8c2fd21. Read the comment docs.

@ktmud
Copy link
Contributor

ktmud commented Aug 15, 2020

Not quite sure how to unit test this, since it depends on the browser.

Here's how I tested it:

it('should use noop functions when console unavailable', () => {

If you have time, might as well do the fallbacks for all other console methods:

const console = window.console || {};
const log = console.log || () => {};
const logger = {
  log,
  warn: console.warn || log,
  debug: console.debug || log,
  ...
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants