UtilUpdated in v16Optional

wrBadgeLog

Logs a message to the browser console behind a coloured badge. wrBadgeWarn() and wrBadgeError() do the same at their level.

Usage

import { wrBadgeLog } from 'ngwr/utils';

wrBadgeLog('SAVED', '#10b981', 'profile updated');

Warnings and errors

The same pill through console.warn and console.error, so the stack trace and the console's level filters still work.

import { wrBadgeError, wrBadgeWarn } from 'ngwr/utils';

wrBadgeWarn('CACHE', '#f59e0b', 'profile is stale');
wrBadgeError('SAVE', '#ef4444', new Error('profile not saved'));

API

NameDescriptionTypeDefault
wrBadgeLog(badge, color, message)Logs message after a badge pill. color paints the pill's border and text, not a fill.(badge, color, message) => void—
wrBadgeWarn(badge, color, message)The same through console.warn.(badge, color, message) => void—
wrBadgeError(badge, color, message)The same through console.error.(badge, color, message) => void—

See also