Some browser console.log utilities inspired by debug.
This package is an ESM, cannot be used directly as a CJS module.
import { getLogger, LogLevel } from '@whitetrefoil/log-utils';
// Optional max level, default is LOG
window.__LOG_LEVEL__ = LogLevel.Debug;
// Optional, console.group OR console.groupCollapsed, default is collapsed
window.__LOG_EXPANDED__ = true;
// Give any tag like debug, personally I'd like to use the file path.
const logger = getLogger(`/src/${__filename.split('?')[0]}`);
logger.error(/*...*/);
logger.warn(/*...*/);
logger.info(/*...*/);
logger.debug(/*...*/);
// `getLogger` has a optional second argument, set to true to disable path sep normalization.
const logger = getLogger(`i'm not a path \ don't touch the backslash`, true);
- Upgrade infra.
- Upgrade to node 20 & latest infrastructure.
- Upgrade to typescript 3.7 & built to a real ESM.
- Upgrade infrastructure to support native ESM.
- Fix missing
flags.d.ts
in lib dir.
- Remove
extract-stack
&clean-stack
for Firefox compatibility issue. - Update dependencies.
- Fix README.
- Update dependencies.
- Don't use
JSON.stringify
when printing.
- Fix crash when
window
is not defined.
- Upgrade infrastructure.
- Fix missing LogLevel export.
- Assume the log tag is a path, enables auto path sep normalization for windows by default.
- Fix
Cannot read property 'print' of undefined
(by binding methods to class).
- Also export
getLogger
besides default.
- Fix build config.
- Initial release.