Util

badgeLog

Console log helper that prints a coloured pill badge before the message — useful for spotting events in a noisy devtools panel.

Usage

import { badgeLog } from 'ngwr/utils';

badgeLog('SAVED', '#10b981', 'profile updated');
// → renders a styled badge in the devtools console

Why ngwr provides this

Coloured-pill devtools logs are great for spotting events in a noisy console — but the native recipe (console.log('%cTAG', '<long css string>', '…')) is unreadable to write and easy to typo. The helper wraps the CSS so the call site only carries the badge text, colour and message.

// Native — readable for the console, painful to write.
console.log(
  '%cSAVED',
  'background:#10b981;color:white;padding:2px 6px;border-radius:4px;font-weight:600',
  'profile updated'
);

// ngwr — same output, no string-of-CSS to typo.
badgeLog('SAVED', '#10b981', 'profile updated');

API

NameDescriptionTypeDefault
badgeLog(badge, color, message)Styled badge log to the browser console — quick dev signal.(badge, color, message) => void