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

Klogger creates empty file even if not used to log() anything #89

Open
johnykvsky opened this issue Jan 20, 2018 · 0 comments
Open

Klogger creates empty file even if not used to log() anything #89

johnykvsky opened this issue Jan 20, 2018 · 0 comments

Comments

@johnykvsky
Copy link

After playting with Slim (middleware and stuff) I noticed that when logger is created and even not used, a log file is created with zero size. Construct run setFileHandle() witch do fopen(...,'a') and this creates empty file, even if I don't log() anything (on PHP7 to be precise).

First I thought of moving setFileHandle() outside constructor or playing with different than 'a' file open modes, but then - why not use file_put_contents. It won't create file until it try to write to it, performance is (according to google) the same.

Do you see any drawbacks of it? Change was quite easy, code got cleaner. If you want, I can make a PR.

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

1 participant