[sheepdog] [PATCH] logger: add date and time to log messages even if an output is stdout

Liu Yuan namei.unix at gmail.com
Thu Dec 20 13:26:16 CET 2012


On 12/20/2012 05:48 PM, Hitoshi Mitake wrote:
> +	if (!la) {
> +		time_t t = time(NULL);
> +		struct tm tm;
> +		gmtime_r(&t, &tm);
> +
> +		snprintf(p, size, "%s %02d %02d:%02d:%02d ", month(tm.tm_mon),
> +			tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
> +		p += strlen(p);
> +	}

Use strftime() as in log_syslog() isn't easier and then no need to call
month()?

Thanks,
Yuan



More information about the sheepdog mailing list