All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog.
- Reviewed, in details, the TYPEDOC documentation, corrected some examples and added more details.
- Updated
README.mdwith minor corrections about extra field output - Updated the
README.mdincluding external function documentation
- Removed the call
this.clearCellIfNotEmpty("")inExcelAppender.constructorsince it produces an error in Office Script indicating:Unexpected token 'this'.
- In
Logger,LoggerImplchanged the name of the methodhasMessagestohasCriticalEventssince it is more consistent with the purpose of the method - Improved TYPEDOC documentation for
src/logger.tsfile.
- Updated
test/unit-test-framework.tsfile with version 1.0.0 from Unit Testing Framework repository. - Improved documentation of
git-basics.mdadding additional commands and common use cases. - Minor corrections in
test/main.tsfile
ExcelAppendercolor map support: ThegetInstancemethod now accepts a color map, allowing users to specify custom font colors for different log levels. The default color map is exposed as a public property, enabling users to reference or modify it for their own configurations.- Additional documentation: Added
git-basics.md, providing concise, project-specific instructions and best practices for using Git effectively within this repository.
- Ensured cross-platform compatibility: Adjustments were made to guarantee the framework works in both Node.js/TypeScript and Office Scripts environments. To pass all tests,
setTimeoutwas used in some cases to handle the asynchronous nature of Office Scripts. - VSCode configuration improvements: The project now uses a dedicated
typesfolder to include all*.d.tsfiles, such as Office Scripts declarations and global variable definitions. This streamlines type management and ensures accurate IntelliSense and type checking within VSCode.
AssertionError**: Introduced a new error class for clearer assertion failure reporting in the unit test framework (unit-test-framework.ts).- Assert enhancements: Added new convenience methods to the
Assertclass, making test writing more robust and expressive (unit-test-framework.ts). - New interfaces and types: Introduced
Logger,Layout, andLogEventinterfaces, as well as theLogEventFactorytype, to enhance extensibility and type safety (logger.ts). - New classes: Added
LoggerImpl,Utility,LayoutImpl,LogEventImpl(logger.ts), andAssertionError(unit-test-framework.ts) to provide a more modular, extensible, and testable architecture. - Layout-based output customization: Appenders now support customizable log message layouts via the
Layoutinterface, which exposes aformatmethod. TheLayoutImplclass allows further customization by accepting a user-definedformatterfunction through its constructor, giving users complete control over log message formatting. VSCode Debuggins.md: Detail documentation on how to debug the library while running tests.
- Logger refactored: The
Loggeris now an interface, implemented by the newLoggerImplclass. Common helper and validation methods have been moved to theUtilityclass for broader reuse. - Appender output control: All appenders now utilize shared formatting logic via the
Layoutinterface (managed withinAbstractAppender). The actual output of log messages is managed by implementing the abstractsendEventmethod in each appender subclass. - ScriptError improvement: Improved the
ScriptError.raiseIfNeededhelper method to support custom error handling scenarios. - Standardized the output of
toString()methods for classes based on best practices. This includes consistent formatting, clear use of public property names, and structured output to improve debugging and testing.
Reference: Best Practices for toString() in JavaScript/TypeScript - Extended the
LogEventinterface to support a generic type parameter for custom extra fields, allowing flexible extension of log event metadata. Adjusted the interfaces and the rest of the classes to allow log event with extra parameters. - Change license from GNU to MIT: Updated the
LICENSEfile.
- Logger API: The previous
Loggerclass has been replaced by aLoggerinterface and aLoggerImplimplementation. All usages must be updated to use the new API. - Appender APIs: Output formatting is now manag ed through the
Layoutinterface and itsformatmethod. Custom layouts may require new construction or configuration patterns. Message output must be implemented viasendEventin subclasses ofAbstractAppender. - Renamed
Logger.clear()toLogger.reset()for clarity. The method now clearly indicates it resets only the error/warning counters and critical event messages, but does not affect singleton instances, appenders, layout, or log event factory. This change improves code readability and avoids confusion with theclear*family of methods used for test-only full resets. - Unit testing: Assertion error handling has changed; tests should now expect the new
AssertionErrorand use the updatedAssertmethods.
- Documentation: Updated README and developer guide to clarify that all logger functionality—including
Logger,ConsoleAppender, andExcelAppender—is now implemented in a single file:src/logger.ts. - Usage Guidance: Examples and instructions now direct users to copy only
src/logger.tsinto their Office Scripts project; all references to separate appender files have been removed. The README now also explains that thedistfolder contains production-ready files withclearInstancemethods removed, and that those methods are only present in source files for testing or development—not for production use. - Testing Instructions: Clearly documented that
clearInstancemethods for logger and appenders are available only in source (not production) code, and are intended for test scenarios. - TypeScript Configuration: Updated
tsconfig.json(strictNullChecks: false) to better match Office Scripts runtime behavior, ensuring that local TypeScript execution emulates Office Scripts' permissiveness withnullandundefined.
- Initial release of the Office Scripts Logging Framework.
- TypeScript-based logger for Office Scripts with mock/test harness.
- GitHub Actions CI workflow.
- Developer workflow and project documentation.