Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default value of Logger.ThreadSafe #11

Open
zeljkoavramovic opened this issue Dec 6, 2017 · 1 comment
Open

Default value of Logger.ThreadSafe #11

zeljkoavramovic opened this issue Dec 6, 2017 · 1 comment

Comments

@zeljkoavramovic
Copy link

zeljkoavramovic commented Dec 6, 2017

I would prefer default value for Logger.ThreadSafe property to be true, or even beter to delete it and use multi thread detection. Something like this that I have used in SafeLogger unit (#2):

procedure LogLock;
begin
  if IsMultiThread then // no need for locking if the only thread in application is the main thread
    Guardian.Enter;
end;

procedure LogUnlock;
begin
  if IsMultiThread then // no need for locking if the only thread in application is the main thread
    Guardian.Leave;
end; 

https://www.freepascal.org/docs-html/rtl/system/ismultithread.html

If Logger.ThreadSafe is not set to true and multiple threads use FileChannel, then EInOutError exception will be raised and users might think that it's Multilog fault.

@blikblum
Copy link
Owner

I updated the repository with automatic threadsafe. Will not bump version for now. Please test if possible with multi threaded if possible

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

No branches or pull requests

2 participants