[Pm-utils] [PATCH] Logging infrastructure
pjones at redhat.com
Sat Oct 21 12:05:57 PDT 2006
On Fri, 2006-10-20 at 15:54 +0200, Stefan Seyfried wrote:
> Is this an acceptable idea? I explicitly went for the "as simple as possible"
> approach, which also makes it trivial for hook writers to use it. All the
> alternatives (a log() function or something like that) would have been more
> complicated to use IMO.
In general, I think this is pretty good.
> I also removed all those "rm /var/run/pm-suspend" lines, since it does not
> hurt to let this file lay around until the next suspend (of course it is
> still deleted then before starting) and it also might contain various hints
> on what went wrong.
I'd rather we just log what's in the file than leave it sitting
Some specific comments below.
> + [ -n "$LOGFILE" ] && ![[ "$LOGFILE" =~ "^/dev/" ] && rm -f $LOGFILE
> + [ -n "$LOGFILE" ] && exec > $LOGFILE 2>&1
This is really ugly :/
if [ -n "$LOGFILE ]; then
[ -f "$LOGFILE" ] && rm -f $LOGFILE
I'm not sure there's any point in redirecting the output of 'touch' to
the logfile -- if touch fails, we can't write to the logfile anyway.
More information about the Pm-utils