コード例 #1
0
void knh_vperror(Ctx *ctx, knh_uri_t uri, int line, int pe, const char *fmt, va_list ap)
{
	DBG_ASSERT(pe <= LOG_DEBUG);
	if(knh_Gamma_isQuiet(ctx->gma)) {
		return;
	}
//	if(pe < KERR_DWARN) {
//		DP(ctx->gma)->statError += 1;
//	}
//	else if(pe < KERR_TINFO) {
//		DP(ctx->gma)->statBadManner += 1;
//	}
	if(knh_Context_isInteractive(ctx)) {
		goto L_PRINT;
	}
	if(pe > KERR_EWARN && !knh_Context_isCompiling(ctx)) {
		return;
	}
	L_PRINT:;
	if(line > 0) {
		knh_OutputStream_t *w = KNH_STDERR;
		knh_printf(ctx, w, " - [%s:%d]:%s ", FILENAME__(uri), (knh_intptr_t)line, KERR_tochar(pe));
		knh_vprintf(ctx, w, fmt, ap);
		knh_write_EOL(ctx, w);
	}
	else {
		knh_vsyslog(ctx, pe, fmt, ap);
	}
}
コード例 #2
0
ファイル: perror.c プロジェクト: matsuu/konoha
void knh_vperror(Ctx *ctx, knh_uri_t uri, int line, int pe, char *fmt, va_list ap)
{
	KNH_ASSERT(pe <= KERR_INFO);
	if(knh_Context_isInteractive(ctx)) {
		goto L_PRINT;
	}
	if(pe > KERR_EWARN && !knh_Context_isCompiling(ctx)) {
		return;
	}
	L_PRINT:;
	{
		OutputStream *w = KNH_STDERR;
		knh_printf(ctx, w, " - [%s:%d]:%s ", knh_safefile(URIDN(uri)), (knh_intptr_t)line, KERR_MSG[pe]);
		knh_vprintf(ctx, w, fmt, ap);
		knh_write_EOL(ctx, w);
		((Context*)ctx)->hasError = 1;
	}
}