I added a new callback in commit 34053f3e3294f003a109913176a8acc446a12f3d
https://gitlab.com/freepascal.org/lazarus/lazarus/-/commit/34053f3e3294f003a109913176a8acc446a12f3d (and the next commit)
property OnDebugLnEx: TLazLoggerWriteExEvent read FOnDebugLnEx write FOnDebugLnEx;
property OnDbgOutEx: TLazLoggerWriteExEvent read FOnDbgOutEx write FOnDbgOutEx;
type
TLazLoggerWriteExEventInfo = record
Group: PLazLoggerLogGroup; // if only one group / remember nestlevel count
DbgOutAtBOL: Boolean; // Only for DbgOut, True if first segment in new line (that is LogIndent will be added, otherwise it wont)
end;
TLazLoggerWriteExEvent = procedure(Sender: TObject; var LogTxt, LogIndent: string; var Handled: Boolean; const AnInfo: TLazLoggerWriteExEventInfo) of object;
- The LogIndent has not yet been added to the LogText.
- You can modify LogIndent and/or LogText (Or combine them, and empty the other)
- Handled works as before
AnInfo is an record => that means more fields can be added in future, without breaking anything.
About the "Group", it will be present if you do
Debuln(LogGroup, 'Foo bar');
Debuln(LogGroup, ['Foo bar', 123]);
or similar.
But not if you do
Debuln(LogGroup or OtherLogGroup, 'Foo bar');
Since then more than one group is in play. (May change later....)
Please test, and let me know if you find any issues with it. Or if you can think of any improvement.