示例#1
0
void VKTS_APIENTRY logPrint(const int32_t verbosity, const char* fileName, const int32_t lineNumber, const char* format, ...)
{
    std::lock_guard<std::mutex> logLockGuard(g_logMutex);

    if (g_verbosity == VKTS_LOG_NOTHING || verbosity == VKTS_LOG_NOTHING)
    {
        return;
    }

    if (g_verbosity >= verbosity)
    {
        const char* logString = "UNKNOWN";
        char buffer[VKTS_MAX_LOG_CHARS + 1];
        va_list argList;

        if (verbosity > VKTS_LOG_NOTHING && verbosity <= VKTS_LOG_SEVERE)
        {
            logString = VKTS_LOG_STRINGS[verbosity];
        }

        buffer[VKTS_MAX_LOG_CHARS] = '\0';

        va_start(argList, format);

        vsnprintf(buffer, VKTS_MAX_LOG_CHARS, format, argList);

        VKTS_PRINTF("VKTS log [%s] in '%s' at %d: %s\n", logString, logGetFilename(fileName), lineNumber, buffer);

        va_end(argList);
    }
}
示例#2
0
VkBool32 VKTS_APIENTRY engineInit()
{
    if (!processorInit())
    {
        VKTS_PRINTF("LOG [VKTS_LOG_ERROR]: Engine: Initialization failed! Could not initialize the processor!\n");

        return VK_FALSE;
    }

    if (!logInit())
    {
        VKTS_PRINTF("LOG [VKTS_LOG_ERROR]: Engine: Initialization failed! Could not initialize logging.\n");

        return VK_FALSE;
    }

    if (!timeInit())
    {
        logPrint(VKTS_LOG_ERROR, "Engine: Initialization failed! Could not initialize the timer!");

        return VK_FALSE;
    }

    if (!barrierInit())
    {
        logPrint(VKTS_LOG_ERROR, "Engine: Initialization failed! Could not initialize the barrier!");

        return VK_FALSE;
    }

    if (!fileInit())
    {
        logPrint(VKTS_LOG_ERROR, "Engine: Initialization failed! Could not initialize the file system!");

        return VK_FALSE;
    }

    return VK_TRUE;
}