[syslog-ng] TAG-Macro

Balazs Scheidler bazsi at balabit.hu
Mon Apr 7 12:22:45 CEST 2008


I've started reviewing your BSDTAG patches and I have some comments:

On Thu, 2008-03-27 at 13:49 +0100, JUNG, Christian wrote:
> +    case M_BSDTAG:
> +      {
> +        const char *n;
> +
> +        g_string_sprintfa(result, "%d", (msg->pri & LOG_PRIMASK));
> +
> +        n = syslog_name_lookup_name_by_value(msg->pri & LOG_FACMASK,
> sl_bsdtag_facilities);

Are you sure you need the sl_bsdtag_facilities lookup? From what I can
see the facility information in the BSD tag field is a direct mapping
from the numerical value to its alphabetical representation.

I mean, I think you can have the same result by using this expression:
isn't this the same:

g_string_sprintfa(result, "%d%c", (msg->pri & LOG_PRIMASK), (msg->pri >>
3) + 'A');

Or am I missing something? If this solution is used, you can skip the
lookup.

-- 
Bazsi



More information about the syslog-ng mailing list