コード例 #1
0
ファイル: logging.c プロジェクト: erikbrinkman/tup
void log_debug_tent(const char *identifier, struct tup_entry *tent, const char *format, ...)
{
	va_list ap;
	if(!enabled)
		return;
	fprintf(logfile, "%s[%lli]: ", identifier, tent->tnode.tupid);
	print_tup_entry(logfile, tent);

	va_start(ap, format);
	vfprintf(logfile, format, ap);
	va_end(ap);
}
コード例 #2
0
ファイル: progress.c プロジェクト: 5kg/tup
void show_result(struct tup_entry *tent, int is_error, struct timespan *ts, const char *extra_text, int always_display)
{
	FILE *f;
	float tdiff = 0.0;

	job_time += tent->mtime;

	if(ts) {
		tdiff = timespan_seconds(ts);
	}

	sum++;
	if(sum > total) {
		fprintf(stderr, "tup internal error: progress bar is sized incorrectly.\n");
	}

	if(quiet && !always_display)
		return;

	if(is_error) {
		got_error = 1;
		f = stderr;
	} else {
		f = stdout;
	}
	clear_active(f);
	color_set(f);
	if(is_error) {
		fprintf(stderr, "* %s", color_error_mode());
	} else {
		printf(" ");
	}
	/* If we aren't going to show a progress bar, then %-complete here is
	 * helpful.
	 */
	if(total && !display_progress) fprintf(f, "%3i%% ", percent_complete());
	if(display_job_numbers) fprintf(f, "%i) ", sum);
	if(display_job_time && ts) {
		fprintf(f, "[%.3fs] ", tdiff);
	}

	if(extra_text)
		fprintf(f, "%s: ", extra_text);

	print_tup_entry(f, tent);
	fprintf(f, "\n");
	color_error_mode_clear();
}