Пример #1
0
void RenderingDebugOutput::addToQueue(
	GLenum source,
	GLenum type,
	GLuint id,
	GLenum severity,
	GLsizei length,
	const GLchar* message)
{
	if (severity < m_minimumSeverityLevel)
		return;

	std::stringstream errorString;

	errorString << "Debug Message:" <<
		"\n\t Source: " << sourceToString(source) <<
		"\n\t Type: " << typeToString(type) <<
		"\n\t Severity: " << severityToString(severity) <<
		"\n\t ID: " << id <<
		"\n\t Message: " << message << "\n";

	if (m_multithreaded)
	{
		std::lock_guard<std::mutex> lock(m_mutex);
		m_log.push_back(std::move(errorString.str()));
	}
	else
	{
		m_func(errorString.str());
	}
}
Пример #2
0
void StreamLogger::log(const Severity &severity, const time_t timestamp, 
    const std::string &message) const
{
    if(severity >= mMinSeverity)
    {
        mLogStream << DateTime::getTimestampString(timestamp) << "|" 
                   << mUnit << "|"
                   << severityToString(severity) << ": "
                   << message << std::endl;
    }
}
Пример #3
0
void logMessage(Severity level, std::string file, int line, std::string function,
        std::string message)
{
    if(level < _level)
    // log severity is smaller than logging level set
        return;

    std::stringstream ss;
    ss << "[" << _tag << "]" << severityToString(level) << " " << file << ":" << line;
    ss << " " << function << "() " << message;

    if(_logger)
    {
        _logger(ss.str());
    }
}
Пример #4
0
util::nstring LogFormatter::format(const Record &record) {
    tm t;
    util::localtime_s(&t, &record.getTime().time);

    util::nstringstream ss;
    ss << t.tm_year + 1900 << "-" << std::setfill(PLOG_NSTR('0')) <<
        std::setw(2) << t.tm_mon + 1 << "-" <<
        std::setfill(PLOG_NSTR('0')) << std::setw(2) << t.tm_mday << " ";
    ss << std::setfill(PLOG_NSTR('0')) << std::setw(2) << t.tm_hour << ":" <<
        std::setfill(PLOG_NSTR('0')) <<
        std::setw(2) << t.tm_min << ":" << std::setfill(PLOG_NSTR('0')) <<
        std::setw(2) << t.tm_sec << "." <<
        std::setfill(PLOG_NSTR('0')) << std::setw(3) <<
        record.getTime().millitm << " ";
    ss << std::setfill(PLOG_NSTR(' ')) << std::setw(5) << std::left <<
        severityToString(record.getSeverity()) << " ";
    ss << record.getMessage().c_str() << "\n";

    return ss.str();
}
Пример #5
0
/** Sets the item's severity and the appropriate background color. */
void
LogTreeItem::setSeverity(tc::Severity type)
{
  /* Change row and text color for serious warnings and errors. */
  if (type == tc::ErrorSeverity) {
    /* Critical messages are red with white text. */
    for (int i = 0; i < 3; i++) {
      setBackgroundColor(i, Qt::red);
      setTextColor(i, Qt::white);
    }
  } else if (type == tc::WarnSeverity) {
    /* Warning messages are yellow with black text. */
    for (int i = 0; i < 3; i++) {
      setBackgroundColor(i, Qt::yellow);
    }
  }
  
  setTextAlignment(COL_TYPE, Qt::AlignCenter);
  setText(COL_TYPE, severityToString(type));
  setData(COL_TYPE, ROLE_TYPE, (uint)type);
}
Пример #6
0
std::string makeErrorReport(exception& e)
{
  std::stringstream s;
  s << std::endl << std::endl;
  s << "-------------------- Error Report --------------------" << std::endl;
  if( std::string const * name=boost::get_error_info<errorName>(e) )
    s << "Name: " << *name << std::endl;
  if( severity const * sev=boost::get_error_info<errorSeverity>(e) )
    s << "Severity: " << severityToString(*sev) << std::endl;
  if( std::string const * title=boost::get_error_info<errorTitle>(e) )
    s << "Title: " << *title << std::endl;
  if( std::string const * desc=boost::get_error_info<errorDescription>(e) )
    s << "Description: " << *desc << std::endl;
  s << "---------------- Diagnostic Information --------------" << std::endl;
  if( const char** func=boost::get_error_info<boost::throw_function>(e) )
    s << "Function: " << *func << std::endl;
  if( const char** file=boost::get_error_info<boost::throw_file>(e) )
    s << "File: " << *file << std::endl;
  if( int const * line=boost::get_error_info<boost::throw_line>(e) )
    s << "Line: " << *line << std::endl;
  s << "------------------------------------------------------" << std::endl << std::endl;
  return s.str();
  
}