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

Deferred logs improvements #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Deferred logs improvements #11

wants to merge 1 commit into from

Conversation

8ctopus
Copy link
Contributor

@8ctopus 8ctopus commented Sep 9, 2022

Deferring logs writing to file has a huge positive impact #9 on speed however it's a bit riskier because if the script terminates in an unclean way, we lose the whole log.

In this pull request, I've added:

  • Add possibility to manually flush deferred logs
  • Fix deferred logs would show up as notice
  • Fix deferred logs would not have new line separator
  • Add flush deferred trigger (flush when x number of logs were stored)

Here's how it looks

    $info = (new File(ConfigBase::logFile(), false))
        ->setMinLevel('info')
        // propagate to other loggers
        ->setCascading(true)
        // postpone/accumulate logs processing
        ->setDeferred(true)
        // automatically flush when the trigger is reached
        ->setDeferredTrigger(100);

Fix deferred logs would show up as notice
Fix deferred logs would not have new line separator
Add flush deferred trigger
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

Successfully merging this pull request may close these issues.

None yet

1 participant