Exemplo n.º 1
0
// AppendFormat
//------------------------------------------------------------------------------
void AString::AppendFormat( const char * fmtString, ... )
{
    AStackString< 1024 > buffer;
	va_list args;
	va_start(args, fmtString);
	buffer.VFormat( fmtString, args );
	va_end( args );

    Append( buffer );
}
Exemplo n.º 2
0
// Build
//------------------------------------------------------------------------------
/*static*/ void FLog::Build( const char * formatString, ... )
{
    AStackString< 8192 > buffer;

    va_list args;
    va_start(args, formatString);
    buffer.VFormat( formatString, args );
    va_end( args );

    Tracing::Output( buffer.Get() );
}
Exemplo n.º 3
0
// Info
//------------------------------------------------------------------------------
/*static*/ void FLog::Info( const char * formatString, ... )
{
    AStackString< 8192 > buffer;

    va_list args;
    va_start(args, formatString);
    buffer.VFormat( formatString, args );
    va_end( args );

    Output( "Info:", buffer.Get() );
}
Exemplo n.º 4
0
// Write
//------------------------------------------------------------------------------
void VSProjectGenerator::Write( const char * fmtString, ... )
{
    AStackString< 1024 > tmp;

    va_list args;
    va_start(args, fmtString);
    tmp.VFormat( fmtString, args );
    va_end( args );

    // resize output buffer in large chunks to prevent re-sizing
    if ( m_Tmp.GetLength() + tmp.GetLength() > m_Tmp.GetReserved() )
    {
        m_Tmp.SetReserved( m_Tmp.GetReserved() + MEGABYTE );
    }

    m_Tmp += tmp;
}
Exemplo n.º 5
0
// Error
//------------------------------------------------------------------------------
void Job::Error( const char * format, ... )
{
	AStackString< 8192 > buffer;

	va_list args;
	va_start(args, format);
	buffer.VFormat( format, args );
	va_end( args );

	if ( IsLocal() )
	{
		FLOG_ERROR( buffer.Get() );
	}
	else
	{
		m_Messages.Append( buffer );
	}
}
Exemplo n.º 6
0
// Error
//------------------------------------------------------------------------------
/*static*/ void FLog::Error( const char * formatString, ... )
{
    // we prevent output here, rather than where the macros is inserted
    // as an error being output is not the normal code path, and a check
    // before calling this function would bloat the code
    if ( FLog::ShowErrors() == false )
    {
        return;
    }

    AStackString< 8192 > buffer;

    va_list args;
    va_start(args, formatString);
    buffer.VFormat( formatString, args );
    va_end( args );

    Output( "Error:", buffer.Get() );
}
Exemplo n.º 7
0
// ShowMessageBox
//------------------------------------------------------------------------------
/*static*/ void Worker::ShowMessageBox( const char * fmtString, ... )
{
	AStackString<> buffer;

	va_list args;
	va_start(args, fmtString);
	buffer.VFormat( fmtString, args );
	va_end( args );

	#if defined( __WINDOWS__ )
		::MessageBox( nullptr, buffer.Get(), "FBuild Worker", MB_OK );
	#elif defined( __APPLE__ )
		// TODO:MAC Implement ShowMessageBox
	#elif defined( __LINUX__ )
		// TODO:LINUX Implement ShowMessageBox
	#else
		#error Unknown Platform
	#endif
}
Exemplo n.º 8
0
// Monitor
//------------------------------------------------------------------------------
/*static*/ void FLog::Monitor( const char * formatString, ... )
{
    // Is monitoring enabled?
    if ( g_MonitorFileStream == nullptr )
    {
        return; // No - nothing to do
    }

    PROFILE_SECTION( "FLog::Monitor" )

    AStackString< 1024 > buffer;
    va_list args;
    va_start( args, formatString );
    buffer.VFormat( formatString, args );
    va_end( args );

    AStackString< 1024 > finalBuffer;
    finalBuffer.Format( "%llu %s", Time::GetCurrentFileTime(), buffer.Get() );

    MutexHolder lock( g_MonitorMutex );
    g_MonitorFileStream->WriteBuffer( finalBuffer.Get(), finalBuffer.GetLength() );
}
Exemplo n.º 9
0
// FormatError
//------------------------------------------------------------------------------
void Error::FormatError( const BFFIterator & iter,
                         uint32_t errNum,
                         const Function * function,
                         const char * message, ... )
{
    ASSERT( message );
    AStackString< 4096 > buffer;

    va_list args;
    va_start(args, message);
    buffer.VFormat( message, args );
    va_end( args );

    // get human readable info about the position of the error
    uint32_t line = 0;
    uint32_t column = 0;
    const char * lineStart = nullptr;
    iter.GetPosInfo( line, column, lineStart );

    // convert to full path and '/'->'\' cleanup
    const AStackString<> fileName( iter.GetFileName() );
    AStackString<> fullPath;
    NodeGraph::CleanPath( fileName, fullPath );

    // deliberately using OUTPUT here to avoid "Error:" in front
    OUTPUT( "%s(%u,%u): FASTBuild Error #%04u - %s%s%s\n",
            fullPath.Get(),
            line,
            column,
            errNum,
            function ? function->GetName().Get() : "",
            function ? "() - " : "",
            buffer.Get() );

    // find the line end
    BFFIterator lineEnd( iter );
    while ( !lineEnd.IsAtEnd() )
    {
        if (( *lineEnd != '\r' ) && ( *lineEnd != '\n' ))
        {
            lineEnd++;
            continue;
        }
        break;
    }

    // if line is too crazy to be useful, don't print anything more
    size_t lineLength = lineEnd.GetCurrent() - lineStart;
    if ( lineLength >= 256 )
    {
        return;
    }

    // print the problematic line
    AString::Copy( lineStart, buffer.Get(), lineLength );
    FLOG_ERROR( "%s", buffer.Get() );

    // point to the specific pos where parsing broke
    // (taking into account tabs)
    char * c = buffer.Get();
    const char * end = c + column - 1;
    for ( ; c < end; ++c )
    {
        if ( *c != '\t' )
        {
            *c = ' ';
        }
    }

    AString::Copy( "^", c, 1 );
    FLOG_ERROR( buffer.Get() );
    AString::Copy( "\\--here", c, 8 );
    FLOG_ERROR( buffer.Get() );
}