Ejemplo n.º 1
0
void Log::log(std::string file, std::string function, int line, std::string msg, int severity)
{
	// if debug output is restricted to certain files, make sure that the output is from the correct file
	if(severity == LOG_DEBUG && restrictFiles.size() != 0){
		bool found = false;
		for(std::vector<std::string>::iterator it = restrictFiles.begin(); it != restrictFiles.end(); it++){
			if(*it == file){
				found = true;
				break;
			}
		}

		if(!found)
			return;
	}

	if(severity >= logLevel){
		std::ostream* out = severity >= LOG_WARNING ? &std::cerr : &std::cout;

		if(severity >= LOG_WARNING || logLevel <= LOG_EXTRA_VERBOSE)
			*out << "[ " << std::left << std::setw(7) << getSeverityName(severity) << " ] ";
		
		if(logLevel <= LOG_EXTRA_VERBOSE){
			std::stringstream ss;
			ss << file << ":" << line << " " << function;
			*out << std::left << std::setw(50) << ss.str();
		}

		*out << msg << std::endl;
	}
}
Ejemplo n.º 2
0
void SkPdfReportUnexpectedType(SkPdfIssueSeverity sev,
                               const char* context,
                               const SkPdfNativeObject* obj,
                               int anyOfTypes, SkPdfContext* pdfContext) {
    if (sev >= kIgnoreError_SkPdfIssueSeverity) {
        printf("%s: %s\n", getSeverityName(sev), context);
    }
}
Ejemplo n.º 3
0
void SkPdfReport(SkPdfIssueSeverity sev, SkPdfIssue issue,
                 const char* context,
                 const SkPdfNativeObject* obj,
                 SkPdfContext* pdfContext) {
    if (sev >= kIgnoreError_SkPdfIssueSeverity) {
        printf("%s: %s\n", getSeverityName(sev), context);
    }
}