[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [Libevent-users] Pass in __FILE__ __LINE__ __func__ for better logging?



On Fri, Mar 19, 2010 at 10:27 PM, Shuo Chen <giantchen@xxxxxxxxx> wrote:
> Hi there,
>
> Now the log callback takes two parameters:
>
> typedef void (*event_log_cb)(int severity, const char *msg);
>
> How about adding another two or thee:
>
> typedef void (*event_log_cb)(int severity, const char *msg, const
> char* file, int line /*, const char* func*/);
>
> Given many logging libraries log file and line info, this may make
> logging message more useful.
>

That would break every program written to use this functionality in
Libevent 1.4 and earlier.  We try not to break backward compatibility
with stable versions.

It would be neat, though, to make our logging format more consistent:
some messages include function names, and some don't.  Maybe we should
just have all of the log functions get the function name via the
appropriate compiler macro, so we stop having to include it as an
argument to every internal log call.   There's no reason IMO a patch
like that against current git master couldn't go into the next version
of 2.0, assuming somebody takes the time to do it.

yrs,
-- 
Nick
***********************************************************************
To unsubscribe, send an e-mail to majordomo@xxxxxxxxxxxxx with
unsubscribe libevent-users    in the body.