C++ (Cpp) LOG Examples

C++ (Cpp) LOG - 30 examples found. These are the top rated real world C++ (Cpp) examples of LOG extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
void IECommandExecutor::AddManagedElement(IHTMLElement* element,
        ElementHandle* element_wrapper) {
    LOG(TRACE) << "Entering IECommandExecutor::AddManagedElement";

    // TODO: This method needs much work. If we are already managing a
    // given element, we don't want to assign it a new ID, but to find
    // out if we're managing it already, we need to compare to all of
    // the elements already in our map, which means iterating through
    // the map. For long-running tests, this means the addition of a
    // new managed element may take longer and longer as we have no
    // good algorithm for removing dead elements from the map.
    bool element_already_managed = false;
    ElementMap::iterator it = this->managed_elements_.begin();
    for (; it != this->managed_elements_.end(); ++it) {
        if (it->second->element() == element) {
            *element_wrapper = it->second;
            element_already_managed = true;
            break;
        }
    }

    if (!element_already_managed) {
        LOG(DEBUG) << "Element is not yet managed";
        BrowserHandle current_browser;
        this->GetCurrentBrowser(&current_browser);
        ElementHandle new_wrapper(new Element(element,
                                              current_browser->GetWindowHandle()));
        this->managed_elements_[new_wrapper->element_id()] = new_wrapper;
        *element_wrapper = new_wrapper;
    } else {
        LOG(DEBUG) << "Element is already managed";
    }
}
Example #2
0
// Called before render is available
bool j1Audio::Awake(pugi::xml_node& config)
{
    LOG("Loading Audio Mixer");
    bool ret = true;
    SDL_Init(0);

    if(SDL_InitSubSystem(SDL_INIT_AUDIO) < 0)
    {
        LOG("SDL_INIT_AUDIO could not initialize! SDL_Error: %s\n", SDL_GetError());
        enabled = false;
        ret = true;
    }

    // load support for the JPG and PNG image formats
    int flags = MIX_INIT_OGG;
    int init = Mix_Init(flags);

    if((init & flags) != flags)
    {
        LOG("Could not initialize Mixer lib. Mix_Init: %s", Mix_GetError());
        enabled = false;
        ret = true;
    }

    //Initialize SDL_mixer
    if(Mix_OpenAudio(MIX_DEFAULT_FREQUENCY, MIX_DEFAULT_FORMAT, 2, 2048) < 0)
    {
        LOG("SDL_mixer could not initialize! SDL_mixer Error: %s\n", Mix_GetError());
        enabled = false;
        ret = true;
    }

    return ret;
}
void Edsm::_search()
{
    // 3. If no blue node is promotable, perform the highest scoring
    //     red/blue merge and then go to step 1
    MergeScores::iterator mergeScore;
    for (mergeScore = this->_mergeScores.begin(); mergeScore != this->_mergeScores.end(); ++mergeScore) {
        if (mergeScore->second != this->_maxScore) {
            continue;
        }

        string redNodeId = mergeScore->first.first;
        string blueNodeId = mergeScore->first.second;

        if (this->_maxScore == this->_minusInfinity) {
            LOG(DEBUG) << "Blue node '" << blueNodeId << "' cannot be merged with any red node, so it is promoted to red";
            this->_colorNodeRed(blueNodeId);
            this->_search();
            return;
        }

        LOG(DEBUG) << "Merging red node '" << redNodeId << "' with blue node '" << blueNodeId << "'";
        this->_merge(redNodeId, blueNodeId);

        this->_search();
        return;
    }

    // 4. Halt
}
Example #4
0
/**@brief Function for passing any pending request from the buffer to the stack.
 */
static void tx_buffer_process(void)
{
    if (m_tx_index != m_tx_insert_index)
    {
        uint32_t err_code;

        if (m_tx_buffer[m_tx_index].type == READ_REQ)
        {
            err_code = sd_ble_gattc_read(m_tx_buffer[m_tx_index].conn_handle,
                                         m_tx_buffer[m_tx_index].req.read_handle,
                                         0);
        }
        else
        {
            err_code = sd_ble_gattc_write(m_tx_buffer[m_tx_index].conn_handle,
                                          &m_tx_buffer[m_tx_index].req.write_req.gattc_params);
        }
        if (err_code == NRF_SUCCESS)
        {
            LOG("[HRS_C]: SD Read/Write API returns Success..\r\n");
            m_tx_index++;
            m_tx_index &= TX_BUFFER_MASK;
        }
        else
        {
            LOG("[HRS_C]: SD Read/Write API returns error. This message sending will be "
                "attempted again..\r\n");
        }
    }
}
Example #5
0
void WebSocket::close(int code, const String& reason, ExceptionCode& ec)
{
    if (code == WebSocketChannel::CloseEventCodeNotSpecified)
        LOG(Network, "WebSocket %p close() without code and reason", this);
    else {
        LOG(Network, "WebSocket %p close() code=%d reason='%s'", this, code, reason.utf8().data());
        if (!(code == WebSocketChannel::CloseEventCodeNormalClosure || (WebSocketChannel::CloseEventCodeMinimumUserDefined <= code && code <= WebSocketChannel::CloseEventCodeMaximumUserDefined))) {
            ec = INVALID_ACCESS_ERR;
            return;
        }
        CString utf8 = reason.utf8(StrictConversionReplacingUnpairedSurrogatesWithFFFD);
        if (utf8.length() > maxReasonSizeInBytes) {
            scriptExecutionContext()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, "WebSocket close message is too long.");
            ec = SYNTAX_ERR;
            return;
        }
    }

    if (m_state == CLOSING || m_state == CLOSED)
        return;
    if (m_state == CONNECTING) {
        m_state = CLOSING;
        m_channel->fail("WebSocket is closed before the connection is established.");
        return;
    }
    m_state = CLOSING;
    if (m_channel)
        m_channel->close(code, reason);
}
void V4L2encStreamHandler::SetBitrate(int bitrate, int maxbitrate,
                                      int bitratemode, const QString & reason)
{
    if (maxbitrate == bitrate)
    {
        LOG(VB_RECORD, LOG_INFO, LOC +
            QString("SetBitrate() -- %1 bitrate %2 kbps CBR")
            .arg(reason).arg(bitrate));
    }
    else
    {
        LOG(VB_RECORD, LOG_INFO, LOC +
            QString("SetBitrate() -- %1 bitrate %2/%3 kbps VBR")
            .arg(reason).arg(bitrate).arg(maxbitrate));
    }

    // Set VBR or CBR mode
    if (bitratemode >= 0)
        m_v4l2.SetVideoBitrateMode(bitratemode);

    // Set average bitrate
    if (bitrate > 0)
        m_v4l2.SetVideoBitrate(bitrate * 1000);

    // Set max bitrate
    if (maxbitrate > 0)
        m_v4l2.SetVideoBitratePeak(maxbitrate * 1000);
}