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 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?

> +	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) ...".

    Karel

-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
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