Exemplo n.º 1
0
void Logger::OutHighlight( const std::string& message, const std::string& location )
{
    std::cout << GetFormattedTimestamp();
    if ( location != "" ) { std::cout << " @ " << location; }
    std::cout << std::endl << "  " << message << std::endl << std::endl;

    std::string loc = location;
    if ( loc == "" ) { loc = "-"; }

    m_file << "<tr class='highlight'>"
        << "<td class='time'>" << GetFormattedTimestamp() << "</td>"
        << "<td class='location'>" << loc << "</td>"
        << "<td class='message'>" << message << "</td>"
        << "</tr>" << std::endl;

    m_rowCount++;
}
Exemplo n.º 2
0
void Logger::Out( const std::string& message, const std::string& location /* = "" */, const std::string& category /* = "" */, bool condition /* = true */, int level /* = 0 */ )
{
    if ( m_categoryFilter.size() > 0 )
    {
        // Filter is active

        if ( category.size() == 0
            || m_categoryFilter.find( category ) == std::string::npos )
        {
            return;
        }
    }

    if ( level < m_logLevel )
    {
        return;
    }

    if ( condition )
    {
        std::cout << GetFormattedTimestamp();
        if ( location != "" ) { std::cout << " @ " << location; }
        std::cout << std::endl << "  " << message << std::endl << std::endl;

        std::string loc = location;
        if ( loc == "" ) { loc = "-"; }

        std::string rowClass = ( m_rowCount % 2 == 0 ) ? "" : "odd";

        m_file << "<tr class='" + rowClass + "'>"
            << "<td class='time'>" << GetFormattedTimestamp() << "</td>"
            << "<td class='location'>" << loc << "</td>"
            << "<td class='message'>" << message << "</td>"
            << "</tr>" << std::endl;

        m_rowCount++;
    }
}
Exemplo n.º 3
0
void Logger::Error( const std::string& message, const std::string& location /* = "" */ )
{
    std::cerr   << "** " << GetTimestamp() << "\t" << message;
    if ( location != "" ) { std::cerr << " @ " << location; }
    std::cerr << "\t LINE " << __LINE__ << " FILE " << __FILE__ ;
    std::cerr << std::endl;

    std::string loc = location;
    if ( loc == "" ) { loc = "-"; }

    m_file << "<tr class='error'>"
        << "<td class='time'>" << GetFormattedTimestamp() << "</td>"
        << "<td class='location'>" << loc << "</td>"
        << "<td class='message'>" << message << "</td>"
        << "</tr>" << std::endl;
}