mirror of
https://github.com/apache/superset.git
synced 2024-09-19 20:19:37 -04:00
feat: logger supports console.table, with console.log fallback (#738)
* feat: logger.table * applying Jesse's feedback * missed a method
This commit is contained in:
parent
2fd1070a2e
commit
86eedab4d0
@ -16,16 +16,23 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
const logger = window.console || {
|
||||
debug() {},
|
||||
log() {},
|
||||
info() {},
|
||||
warn() {},
|
||||
error() {},
|
||||
trace() {},
|
||||
|
||||
const console = window.console || {};
|
||||
const log = console.log || (() => {});
|
||||
|
||||
const logger = {
|
||||
log,
|
||||
debug: console.debug || log,
|
||||
info: console.info || log,
|
||||
warn: console.warn || log,
|
||||
error: console.error || log,
|
||||
trace: console.trace || log,
|
||||
table: console.table || log,
|
||||
};
|
||||
|
||||
/**
|
||||
* Superset frontend logger, currently just an alias to console.
|
||||
* This may be extended to support numerous console operations safely
|
||||
* i.e.: https://developer.mozilla.org/en-US/docs/Web/API/Console
|
||||
*/
|
||||
export default logger;
|
||||
|
@ -55,6 +55,10 @@ describe('logging', () => {
|
||||
logging.warn('warn');
|
||||
logging.error('error');
|
||||
logging.trace();
|
||||
logging.table([
|
||||
[1, 2],
|
||||
[3, 4],
|
||||
]);
|
||||
}).not.toThrow();
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user