Skip to content

Logging framework - #1282

Open
isc-jlechtne wants to merge 11 commits into
mainfrom
logging-framework
Open

isc-jlechtne wants to merge 11 commits into
mainfrom
logging-framework

Conversation

@isc-jlechtne

Copy link
Copy Markdown
Collaborator

Addresses #1240

Adds a new logging framework to IPM so that output gets saved to a file. Two log files get generated, a plain .txt file as well as a json lines .jsonl file to be read by an AI.

Additions

  • $$$LogLine(<message>, <level>, <writeToTerminal>) macro.
    • Replaces existing write statements to be able to write to log files
    • Writes message to the log files (if applicable), always in the most verbose mode
    • By default, uses verbosity with the command to print to terminal, override by passing in a 1 for the writeToTerminal param
  • -log-dir modifier
    • Specifies the directory to generate log files to (defaults to <manager directory>/ipm-logs/<current namespace>
  • -no-log modifier
    • Do not generate log file(s) with the command

This logging to a file is currently only supported via the Install/Load/Update/Uninstall commands, though the framework is in place to easily add it to other commands as needed.

isc-cborbonm and others added 11 commits November 19, 2026 14:13
* first commit

* add todo

* add timestamp

* add write of timestamp

---------

Co-authored-by: Carolina BorbonMiranda <carolina.borbonmiranda@intersystems.com>
* first pass at the logging schema

* added json schema to log schema

* Added TimeStampEnd and TimeStampStart to LogManager

* Log initialization takes in the full shell command as well as the isolated command name

* Update log manager to take in parsed command info to initialize the log

* Removed module object as a property of the LogManager class, updated access of commandInfo so malformed commands can be logged too

* Tweak to terminal output in Log Manager
* Updating $$$LogLine macro to allow variable number of args

* Simplifying if-statement to or-statement

* Nit updates

* Removing "verbosely" from comment

---------

Co-authored-by: James Lechtner <James.Lechtner@intersystems.com>
#1277)

* Replacing write statments with $$$LogLine for paths executable via the Install/Load/Update/Uninstall commands

* No blank lines in json files, fixing namespace excursion vulnerability

* Remove any formatting sent to $$$LogLine (to be implemented in LogManager.cls at a later point)

* Replacing extra spaces with $char(9) in one location

---------

Co-authored-by: James Lechtner <James.Lechtner@intersystems.com>
* Initial commit - First install tests and testing modules

* Logging test structures (prior to actual logging)

* Updating existing tests from initial reveiws

* Updating tests after running with updated LogManager class file

* Adding unit tests

* Adding verification for error messages

* Removing hard-coded paths

* Updating to fit new frameworks

* Fixing broken unit test as using macros for level where possible

---------

Co-authored-by: James Lechtner <James.Lechtner@intersystems.com>
* Added infrastructure for output redirection

* Fixed double write to terminal issue when redirecting

* Updated EndChainedCaptureToLog to throw errors rather than returning a status

* removed unnecessary method, improved WriteLogLine() error handling to write to messages.log, and simply flushing method

* Cleaned up stale comments and code

* Moved out common utility methods for unit and integration tests into its own method

* Remove logging finalized write out of the terminal

* Rename general test utility class and declared it correctly in module.xml to maintain correct compilation order

* Update error handling of WriteToConsoleLog

* Add correct unit test declaration for general utility methods to module.xml

* Added comments and modernized args

* Add comments and remove an error thrown

* Fix silent error of redirect handler never being restored when the two types of capture methods are nested in a staggered way

* move test utility files back to Test.PM.Integration.Base and move the ChainedCapture unit tests into the RedirectToLog integration test

* Add error handling to fwd() subroutine

* Add handling and testing for CRLF line endings on redirected lines

* Tweak test to account for timestamp differences

* Improve TestErrorLoggedAndEchoed test

* Address review comments

* Add error throwing into TestLineWithNewLineLoggedCleanly() to ensure we don't incorrectly match empty strings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants