Re: [PATCH] Re: [PEAR-DEV] Log_file behavior in long running apps
| From: | Jon Parise | Date: | Thu, 10 Jul 2003 04:56:32 +0000 |
| Subject: | Re: [PATCH] Re: [PEAR-DEV] Log_file behavior in long running apps | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-18116@lists.php.net to get a copy of this message | ||
On Sat, Jul 05, 2003 at 09:44:24PM +0200, Roman Neuhauser wrote:
> > > > People have been asking for configurable timestamp and output formats.
> > >
> > > Add reverting to fwrite() right in log() to that list, please. :)
> >
> > Feel free to submit your own version, as well.
>
> Ok, here's a patch.
>
> Log_file::log() now writes the line straight away which should speed
> it up by ~20% compared to using the _logLines array.
>
> witeOut() is now a noop because of the above change.
>
> dontLog() only affects further log() calls (same reason).
>
> I haven't added resumeLogging() or anything like that. (I don't
> believe this class should have such behavior at all. It's supposed
> to log stuff, right? Why bother with dontLog()?)
>
> The constructor now looks for lineFormat index in the $conf array(),
> possible escapes are %{time}, %{ident}, %{prio}, %{msg}. This allows
> for arbitrarily structured log format.
> Defaults to '%{time} %{ident} [%{prio}] %{msg}' (no change).
>
> The constructor now looks for eof index in the $conf array(),
> allowing the user choose the preferred eol string.
> Defaults to "\r\n" for BC.
>
> There's other stuff that could be improved, but I don't want to
> stuff it all in one patch, it contains two unrelated changes
> already. Let me know what you think.
>
> NB this patch has some rough edges as I don't want to spend too
> much time on it if you decide it's not good enough. If/when I know
> this is the way to go I'll polish it. Or you can do it. :)
Okay, I just committed a rewrite of the Log_file class based largely
on your patch. Please take a look when you get a chance. Log 1.7.0
is really starting to contain a lot of new code so I'm not in any rush
to release it. In fact, I'll probably push out a release candidate
first.
--
Jon Parise (jon@php.net) :: The PHP Project (http://www.php.net/)