Major Release - Breaking Changes
This release consolidates all v1.4.0 improvements and removes deprecated exports for a cleaner, simpler API.
Breaking Changes:
- Property Name Improvements - Better, clearer names with proper grammar:
enableLogging→loggingEnabled(better grammar for state property)enableEvents→enableDispatchEvents(clearer what it controls vsmaxEvents)
- Removed
iLoggerandiLoggerValidatorexports - These are no longer available as public exports. Client validation is now internal to the Logger class. - Removed subpath exports -
i45-jslogger/validatorandi45-jslogger/interfaceare no longer available. - Changed
addClient()return type - Now returnsbooleaninstead of0|1. - Changed
removeClient()return type - Now returnsbooleaninstead ofvoid. - Event namespacing - CustomEvent names now prefixed with
i45-logger:(e.g.,i45-logger:LOGinstead ofLOG) - Removed deprecated
clearEvents()method - UseclearEventLog(),clearConsole(), orclearAll()instead.
Migration Guide:
// Before v2.0.0
import { Logger, iLogger, iLoggerValidator } from "i45-jslogger";
const isValid = iLoggerValidator.isValid(myClient);
if (logger.addClient(myClient) === 1) {
/* ... */
}
logger.enableLogging = true;
logger.enableEvents = true;
window.addEventListener("LOG", handler);
logger.clearEvents();
// After v2.0.0
import { Logger } from "i45-jslogger";
// or: import logger from 'i45-jslogger';
const isValid = logger.isValidClient(myClient);
if (logger.addClient(myClient)) {
/* ... */
}
logger.loggingEnabled = true;
logger.enableDispatchEvents = true;
window.addEventListener("i45-logger:LOG", handler);
logger.clearAll(); // or clearEventLog() / clearConsole()New Features from v1.4.0:
- Default logger export - Simple usage:
import logger from 'i45-jslogger' - Hybrid API - Default instance for simple cases,
new Logger()for advanced use - Comprehensive TypeScript definitions - Full IntelliSense support with JSDoc comments
- Environment detection - Safe for Node.js, SSR, and browser environments
- Streamlined documentation - Example-focused README, API details in TypeScript definitions
- Storage limits -
maxEventsproperty to limit stored events (prevents unbounded memory growth) - Improved error handling - Client errors are isolated and logged without breaking the logging chain
- Comprehensive test coverage - 30+ tests across 5 test files covering all features
Architecture Improvements:
- Internal validation - Client validation consolidated into Logger class
- Smaller bundle - Reduced from 4 build outputs to 2 (logger.js + logger.d.ts)
- Cleaner API - No exposed implementation details
- Better build process - Rollup bundler with proper ES modules
- Event namespacing - Prevents global window pollution and conflicts with other libraries
- Removed deprecated methods - Clearer, more focused public API
- Error isolation - Try-catch blocks around client calls prevent failures from propagating
- Better error messages - Property validation provides specific, actionable feedback
New Methods:
clearEventLog()- Clear event log from localStorageclearConsole()- Clear browser consoleclearAll()- Clear both event log and consolemaxEventsproperty - Limit stored events (null=unlimited, positive integer=limit, 0=disable storage)loggingEnabledproperty - Control all logging (replacesenableLoggingwith better grammar)enableDispatchEventsproperty - Control CustomEvent dispatching (replacesenableEventswith clearer naming)
Deprecated Methods (still functional):
None - all deprecated methods have been removed in v2.0.0 for a cleaner API.
Environment Support:
| Environment | Logging | localStorage | Events | Status |
|---|---|---|---|---|
| Browser | ✅ | ✅ | ✅ | Full |
| Node.js | ✅ | ❌ | ❌ | Limited |
| SSR | ✅ | Compatible |
What You Get:
- TypeScript support with full type definitions
- Method chaining for all logging methods
- Custom logger clients for extensibility
- Event dispatching with CustomEvents
- localStorage persistence
- Environment-safe execution
Documentation:
- Streamlined README focused on practical examples
- Comprehensive TypeScript definitions with JSDoc
- Clear migration guide for v1.x users
- Full changelog with breaking changes highlighted
Production Ready:
v2.0.0 is production-ready with:
- ✅ 25+ comprehensive tests (100% passing)
- ✅ Complete TypeScript definitions
- ✅ Full documentation and migration guides
- ✅ Clean, validated API with proper error handling
- ✅ Storage limits and error isolation
- ✅ Event namespacing to prevent conflicts
Looking Ahead:
Planning for v3.0.0 has begun - see v3.0.0.md for:
- Architecture refactoring (separated concerns)
- Plugin system
- Async client support
- Enhanced Node.js compatibility
- Performance optimizations
- Initial release.
- Basic logging to the console and local storage.
- Added iLogger interface that can be used to implement and extend the Logger.
- Added iLoggerValidator to validate a custom Logger against the interface.
- Refactoring and minor bug fixes.
- Added support for custom logger.
- Added support for dispatch events.
- Updated documentation.
- Added test project.
- iLoggerValidator now validates against an Array of method names instead of an object.
- Removed getEvents() as a required method for custom loggers.
- Changed react and react-dom from dependencies to dev dependencies.
Critical Fixes:
- Fixed all syntax errors in README documentation (typos, extra periods, incorrect parameter names)
- Fixed build process - now uses Rollup for proper bundling instead of simple file copying
- Added comprehensive TypeScript definitions with full API documentation
- Added environment detection for browser-only APIs (window, localStorage, CustomEvent)
- Fixed
addClient()andremoveClient()to return boolean instead of 0/1 for consistency
Breaking Changes:
addClient()now returnsbooleaninstead of0|1removeClient()now returnsbooleaninstead ofvoid- Removed
iLoggerandiLoggerValidatorexports - validation is now internal - Removed subpath exports (
./validatorand./interface)
New Features:
- Default logger export - Can now use
import logger from 'i45-jslogger'for simple cases - Hybrid API - Supports both default instance and custom instances for flexibility
- Internal validation - Client validation consolidated into Logger class (no separate files needed)
- Package now includes proper exports map for better tree-shaking
- Added TypeScript type definitions file (
logger.d.ts) - Environment-safe: Won't crash in Node.js environments
- Simplified build process with Rollup bundler (2 outputs instead of 4)
Improvements:
- Deprecated clearEvents() method
- Added clearEventLog(), clearConsole(), and clearAll() methods
- Added getters and setters with validation for properties
- Enhanced package.json with module and types fields
- Streamlined README - focused on examples, TypeScript definitions provide API details
Developer Experience:
- Full IntelliSense/autocomplete support in TypeScript and JavaScript
- Comprehensive JSDoc comments for all public APIs
- Improved error messages and validation
- Smaller package size (removed separate interface/validator files)