Re: [PATCH 06/10] logger: add function pointer to choose how logging is done

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24 July 2014 10:44, Karel Zak <kzak@xxxxxxxxxx> wrote:
> On Tue, Jul 22, 2014 at 11:00:55PM +0100, Sami Kerola wrote:
>> +     void (*syslogfp)(struct logger_ctl *ctl, char *msg);
>
>  What about to move it to the control struct too?

Oh, I see. Done, and that allows the later main() clean up.

https://github.com/kerolasa/lelux-utiliteetit/commit/4d0dc65a487f7bc24899e622158b604fe95d1c4b

>> +     if (server) {
>> +             ctl.fd = inet_socket(server, port, socket_type);
>> +             syslogfp = syslog_rfc3164;
>> +     } else if (usock) {
>> +             ctl.fd = unix_socket(usock, socket_type);
>> +             syslogfp = syslog_rfc3164;
>> +     } else {
>> +             openlog(ctl.tag ? ctl.tag : xgetlogin(), ctl.logflags, 0);
>> +             syslogfp = syslog_local;
>> +     }
>
> Maybe it would be better to create small functions
>
>   logger_open()
>   logger_log()
>   logger_close()
>
> to keep main() simple and readable and without all the details like
> "if (usock) ...".

Done in new main() clean up commit.

https://github.com/kerolasa/lelux-utiliteetit/commit/bb840ac3eb832f404f470f8933070f228a104b8e

-- 
Sami Kerola
http://www.iki.fi/kerolasa/
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux