rmcanany / SolidEdgeHousekeeper

Utility for finding annoying little errors in your Solid Edge project
MIT License
23 stars 10 forks source link

Streamline Error Logging #113

Open rmcanany opened 2 months ago

rmcanany commented 2 months ago

Maybe a static class, ErrorLogger, that can receive feedback from anywhere without the need to pass around a dictionary. Any method that needs to report an error could ping the logger with something like EL.CurrentTask(method.Name). If an error is encountered, issue something like EL.ReportError(method.Name, ErrorString). I guess it would also have to report an exit from the method, too.

The logger would maybe create/maintain a hierarchical structure something like:

Part1.par OpenSave Can't save a read only file Part7.psm SaveModelAs (No further messages indicates success) Asm1.asm UpdateModelStylesFromTemplate UpdateDimensionStyles Unable to update 'ANSI(mm)' RemoveViewStyles Unable to remove 'HIDDEN LINE'

It could also capture stack traces from an abort and turn them into a more easily digestible format

Once the run is complete, a request for a report could be issued, possibly including a flag for the format of the output (eg .txt, .csv)

rmcanany commented 2 months ago

Probably not a static class. Each Task runs on its own thread. That approach could cause issues.