You are not logged in.
Pages: 1
Hi Arnaud, i have a question / Feature for Logging.
Is it possible to Disable Logging for 1 Thread after calling function like DisableLog
Reason: I have recurring Function called by a Timer which do nothing if Query gives no result, but flod the log with "useless" stuff if they find something by Query i will Enable Log.
here a sample
function DoOnTimer;
begin
TSynLog.DisableLog;
if ....Orm.RetrieveListObjArray(list, TOrmQueue, 'Status=?', [ord(TOrmStatus.New)], '*') then begin
TSynLog.EnableLog; // Enables Log
// Do something with logging enabled
TSynLog.Enter('Data Found');
end;
// Calls EnableLog on exit (Like Enter/Leave) if Log enabled does nothing :)
end;
Rad Studio 12.3 Athens / 13.0 Ganymede
Offline
Ok, no issue created, but I implemented it anyway.
https://github.com/synopse/mORMot2/commit/af2c5be68
core: new TSynLogFamily.DisableCurrentThread property
- allow to temporarly avoid logging in the current thread
- after setting true to this property, should eventually be reset to false
- won't affect exceptions logging, as one would expect for safety reasons
But you need to make your own eventual
TSynLog.Family.DisableCurrentThread := true;
try
...
finally
TSynLog.Family.DisableCurrentThread := false;
end;
Offline
Pages: 1