当前位置: 首页>>代码示例>>C++>>正文


C++ ERRLOG函数代码示例

本文整理汇总了C++中ERRLOG函数的典型用法代码示例。如果您正苦于以下问题:C++ ERRLOG函数的具体用法?C++ ERRLOG怎么用?C++ ERRLOG使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ERRLOG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: WuResubmit

bool WuResubmit(const char *wuid)
{
    Owned<IWorkUnitFactory> factory = getWorkUnitFactory();
    Owned<IWorkUnit> wu = factory->updateWorkUnit(wuid);
    if (!wu)
    {
        ERRLOG("WuResubmit(%s): could not find workunit",wuid);
        return false;
    }
    if (wu->getState()!=WUStateFailed)
    {
        ERRLOG("WuResubmit(%s): could not resubmit as workunit state is '%s'", wuid, wu->queryStateDesc());
        return false;
    }
    SCMStringBuffer token;
    wu->getSecurityToken(token);
    SCMStringBuffer user;
    SCMStringBuffer password;
    extractToken(token.str(), wuid, user, password);
    wu->resetWorkflow();
    wu->setState(WUStateSubmitted);
    wu->commit();
    wu.clear();
    submitWorkUnit(wuid,user.str(),password.str());

    PROGLOG("WuResubmit(%s): resubmitted",wuid);
    return true;
}
开发者ID:RobertoMalatesta,项目名称:HPCC-Platform,代码行数:28,代码来源:swapnodelib.cpp

示例2: ERRLOG

IOReturn
IOI2CDevice::unlockI2CBus(
	UInt32	clientKey)
{
	IOReturn	status;

	if (ml_at_interrupt_context())
	{
		ERRLOG("[email protected]%lx::unlockI2CBus from primary interrupt context not permitted\n", fI2CAddress);
		return kIOReturnNotPermitted;
	}

	if (isI2COffline())
	{
		ERRLOG("[email protected]%lx::unlockI2CBus device is offline\n", fI2CAddress);
		return kIOReturnOffline;
	}

	status = fProvider->callPlatformFunction(symUnlockI2CBus, false, (void *)0, (void *)clientKey, (void *)0, (void *)0);
	if (kIOReturnSuccess != status)
	{
		ERRLOG("[email protected]%lx::unlockI2CBus controller unlock failed key:%lx status:0x%x\n", fI2CAddress, clientKey, status);
		return status;
	}

//	DLOG("[email protected]%lx::unlockI2CBus - device UNLOCKED key:%lx\n", fI2CAddress, clientKey);

	I2CUNLOCK;

	return status;
}
开发者ID:aosm,项目名称:IOI2CFamily,代码行数:31,代码来源:IOI2CDevice.cpp

示例3: ERRLOG

//Called when Logging manager is created. Create logging agents based on settings
bool CLoggingManager::init(IPropertyTree* cfg, const char* service)
{
    if (!cfg)
    {
        ERRLOG(EspLoggingErrors::ConfigurationFileEntryError, "Logging Manager setting not found for %s", service);
        return false;
    }

    Owned<IPTreeIterator> loggingAgentSettings = cfg->getElements("LogAgent");
    ForEach(*loggingAgentSettings)
    {
        IPropertyTree& loggingAgentTree = loggingAgentSettings->query();
        const char* agentName = loggingAgentTree.queryProp("@name");
        const char* agentType = loggingAgentTree.queryProp("@type");
        const char* agentPlugin = loggingAgentTree.queryProp("@plugin");
        if (!agentName || !*agentName || !agentPlugin || !*agentPlugin)
            continue;

        IEspLogAgent* loggingAgent = loadLoggingAgent(agentName, agentPlugin, service, cfg);
        if (!loggingAgent)
        {
            ERRLOG(-1, "Failed to create logging agent for %s", agentName);
            continue;
        }
        loggingAgent->init(agentName, agentType, &loggingAgentTree, service);
        IUpdateLogThread* logThread = createUpdateLogThread(&loggingAgentTree, service, agentName, loggingAgent);
        if(!logThread)
            throw MakeStringException(-1, "Failed to create update log thread for %s", agentName);
        loggingAgentThreads.push_back(logThread);
    }

    initialized = true;
    return !loggingAgentThreads.empty();
}
开发者ID:Michael-Gardner,项目名称:HPCC-Platform,代码行数:35,代码来源:loggingmanager.cpp

示例4: ptm_lib_complete_msg

int ptm_lib_complete_msg(ptm_lib_handle_t *hdl, void *ctxt, char *buf, int *len)
{
	ptm_lib_msg_ctxt_t *p_ctxt = ctxt;
	csv_t *csv;
	csv_record_t *rec;

	if (!p_ctxt) {
		ERRLOG("%s: no context \n", __FUNCTION__);
		return -1;
	}

	csv = p_ctxt->csv;
	rec = csv_record_iter(csv);

	_ptm_lib_encode_header(csv, rec, (csvlen(csv) - PTMLIB_MSG_HDR_LEN),
			       PTMLIB_MSG_VERSION, p_ctxt->type, p_ctxt->cmd_id,
			       hdl->client_name);

	/* parse csv contents into string */
	if (buf && len) {
		if (csv_serialize(csv, buf, *len)) {
			ERRLOG("%s: cannot serialize\n", __FUNCTION__);
			return -1;
		}
		*len = csvlen(csv);
	}

	csv_clean(csv);
	csv_free(csv);
	free(p_ctxt);

	return 0;
}
开发者ID:Azure,项目名称:sonic-bcm-lkm,代码行数:33,代码来源:ptm_lib.c

示例5: strncpy

		int CMainLoop::Init(const char *szConfigFile,const char *szBinName)
		{
			if (NULL == szConfigFile || NULL == szBinName)
				return -1;

			int iRet;

			// prepare;
			if (NULL != m_buff)
				delete[]m_buff;
			m_buff = new char[COMMON_BUFF_SIZE];

			// read config;
			strncpy(m_stConfig.m_szBinName, szBinName, sizeof(m_stConfig.m_szBinName) - 1);
			strncpy(m_szConfigFile,szConfigFile, sizeof(m_szConfigFile) - 1);
			iRet = ReadConfig();
			if (iRet)
			{
				ERRLOG("ReadConfig fail!ret[%d]",iRet);
				return -1;
			}

			// init log;
			_releaseMem(m_pLog);
			m_pLog = new ns::common::CLog();

			char temp[256];

			snprintf(temp, sizeof(temp), "../log/%s", m_stConfig.m_szBinName);
			m_pLog->init(temp, 1000, 10, ns::common::CLog::LOG_MODE_ERROR);

			// init thread;
			iRet = CreateThread();
			if (iRet)
			{
				ERRLOG("CreateThread fail!ret[%d]",iRet);
				return -1;
			}

			// init listen socket;
			m_pSocket = new TSocket[m_stConfig.m_iTcpListenPortNum];

			// init epoll;
			iRet = m_epollMng.Init(100);
			if (iRet)
			{
				ERRLOG("m_epollMng init fail!ret[%d]", iRet);
				return -1;
			}

			// begin listen;
			iRet = InitListenPort();
			if (iRet)
			{
				ERRLOG("InitListenPort fail!ret[%d]",iRet);
				return -1;
			}

			return 0;
		}
开发者ID:keenbo,项目名称:abc,代码行数:60,代码来源:mainloop.cpp

示例6: ERRLOG

bool CLoggingManager::saveToTankFile(IEspUpdateLogRequestWrap& logRequest, CLogRequestInFile* reqInFile)
{
    if (!logFailSafe.get())
    {
        ERRLOG("CLoggingManager::saveToTankFile: logFailSafe not configured.");
        return false;
    }

    unsigned startTime = (getEspLogLevel()>=LogNormal) ? msTick() : 0;

    StringBuffer GUID;
    logFailSafe->GenerateGUID(GUID, NULL);
    reqInFile->setGUID(GUID);
    reqInFile->setOption(logRequest.getOption());

    StringBuffer reqBuf;
    Owned<IEspUpdateLogRequestWrap> logRequestFiltered = logContentFilter.filterLogContent(&logRequest);
    if (!serializeLogRequestContent(logRequestFiltered, GUID, reqBuf))
    {
        ERRLOG("CLoggingManager::saveToTankFile: failed in serializeLogRequestContent().");
        return false;
    }

    logFailSafe->AddACK(GUID);//Ack this logging request since the task will be done as soon as the next line is called.
    logFailSafe->Add(GUID, reqBuf, reqInFile);

    ESPLOG(LogNormal, "LThread:saveToTankFile: %dms\n", msTick() - startTime);
    return true;
}
开发者ID:stuartort,项目名称:HPCC-Platform,代码行数:29,代码来源:loggingmanager.cpp

示例7: catch

bool CLogThread::FetchTransactionSeed(StringBuffer& TransactionSeedID)
{
    try{
        Owned<IClientTransactionSeedRequest> pSeedReq = m_pLoggingService->createTransactionSeedRequest();
        Owned<IClientTransactionSeedResponse> pSeedResp = m_pLoggingService->TransactionSeed(pSeedReq.get());
        //if we get to here then we have made the request but no seeds are available
        bMadeSeedRequest = true;
        if(pSeedResp->getSeedAvailable()==true)
        {
            TransactionSeedID.appendf("%s",pSeedResp->getSeedId());
            return true;
        }
        else
            return false;
    }
    catch(IException* ex)
    {
        StringBuffer errorStr;
        ex->errorMessage(errorStr);
        ERRLOG("Exception caught generating transaction seed (%d) %s",ex->errorCode(),errorStr.str());
        ex->Release();
    }
    catch(...)
    {
        ERRLOG("Unknown exception caught generating transaction seed");
    }
    return false;
}
开发者ID:AlexLuya,项目名称:HPCC-Platform,代码行数:28,代码来源:LogThread.cpp

示例8: _releaseMem

		int CMainLoop::CreateThread()
		{
			if (m_stConfig.m_iThreadNum < 0)
				return -1;
			int iRet;

			_releaseMem(m_pThreadArray);
			m_pThreadArray = new (std::nothrow)ThreadLoop[m_stConfig.m_iThreadNum];
			if (NULL == m_pThreadArray)
			{
				ERRLOG("New ThreadLoop fail!");
				return -1;
			}

			m_pAuxConsumeMessageCount = new (std::nothrow)uint64_t[m_stConfig.m_iThreadNum];
			if (NULL == m_pAuxConsumeMessageCount)
			{
				ERRLOG("new m_pAuxConsumeMessageCount fail\n");
				return -2;
			}

			for (int i = 0; i < m_stConfig.m_iThreadNum; i++)
			{
				iRet = m_pThreadArray[i].Init(i,this);
				if (iRet)
				{
					ERRLOG("Init Thread[%d] fail!ret[%d]",i,iRet);
					return -1;
				}

				m_pAuxConsumeMessageCount[i] = 0;
			}

			return 0;
		}
开发者ID:keenbo,项目名称:abc,代码行数:35,代码来源:mainloop.cpp

示例9: Java_org_deadc0de_apple2ix_Apple2Preferences_nativeSetTouchJoystickButtonTypes

void Java_org_deadc0de_apple2ix_Apple2Preferences_nativeSetTouchJoystickButtonTypes(JNIEnv *env, jclass cls, jint touchDownButton, jint northButton, jint southButton) {
    LOG(": %d,%d,%d", touchDownButton, northButton, southButton);

    touchDownButton -= 1;
    northButton -= 1;
    southButton -= 1;
    if (touchDownButton < TOUCH_NONE || touchDownButton > TOUCH_BOTH) {
        ERRLOG("OOPS, invalid parameter!");
        return;
    }
    if (northButton < TOUCH_NONE || northButton > TOUCH_BOTH) {
        ERRLOG("OOPS, invalid parameter!");
        return;
    }
    if (southButton < TOUCH_NONE || southButton > TOUCH_BOTH) {
        ERRLOG("OOPS, invalid parameter!");
        return;
    }

    uint8_t rosetteChars[ROSETTE_COLS * ROSETTE_ROWS];
    int rosetteScancodes[ROSETTE_COLS * ROSETTE_ROWS];
    rosetteChars[ROSETTE_NORTHWEST] = ' ';                      rosetteScancodes[ROSETTE_NORTHWEST] = -1;
    rosetteChars[ROSETTE_NORTH]     = (uint8_t)MOUSETEXT_UP;    rosetteScancodes[ROSETTE_NORTH]     = -1;
    rosetteChars[ROSETTE_NORTHEAST] = ' ';                      rosetteScancodes[ROSETTE_NORTHEAST] = -1;
    rosetteChars[ROSETTE_WEST]      = (uint8_t)MOUSETEXT_LEFT;  rosetteScancodes[ROSETTE_WEST]      = -1;
    rosetteChars[ROSETTE_CENTER]    = '+';                      rosetteScancodes[ROSETTE_CENTER]    = -1;
    rosetteChars[ROSETTE_EAST]      = (uint8_t)MOUSETEXT_RIGHT; rosetteScancodes[ROSETTE_EAST]      = -1;
    rosetteChars[ROSETTE_SOUTHWEST] = ' ';                      rosetteScancodes[ROSETTE_SOUTHWEST] = -1;
    rosetteChars[ROSETTE_SOUTH]     = (uint8_t)MOUSETEXT_DOWN;  rosetteScancodes[ROSETTE_SOUTH]     = -1;
    rosetteChars[ROSETTE_SOUTHEAST] = ' ';                      rosetteScancodes[ROSETTE_SOUTHEAST] = -1;
    joydriver_setTouchAxisTypes(rosetteChars, rosetteScancodes);
    joydriver_setTouchButtonTypes((touchjoy_button_type_t)touchDownButton, -1, (touchjoy_button_type_t)northButton, -1, (touchjoy_button_type_t)southButton, -1);
}
开发者ID:jvernet,项目名称:apple2,代码行数:33,代码来源:jniprefs.c

示例10: initTimeEvent

void initTimeEvent(struct aeEventLoop* eventLoop) {
    struct time_ev_priv_data* background_time_ev_data = zmalloc(sizeof(struct time_ev_priv_data));
    if (NULL == background_time_ev_data)
    {
        ERRLOG("memory is not enough.");
        exit(1);
    }
    background_time_ev_data->id = 0;
    if (aeCreateTimeEvent(eventLoop, 1, tBackgroundTask, background_time_ev_data, tEventFinalizerProc) == AE_ERR) {
        ERRLOG("Can't create the tBackgroundTask time event.");
        exit(1);
    }

    struct time_ev_priv_data* echo_task_data = zmalloc(sizeof(struct time_ev_priv_data));
    if (NULL == echo_task_data)
    {
        ERRLOG("memory is not enough.");
        exit(1);
    }
    echo_task_data->id = 1;
    if (aeCreateTimeEvent(eventLoop, 1, tEchoTask, echo_task_data, tEventFinalizerProc) == AE_ERR) {
        ERRLOG("Can't create the tEchoTask time event.");
        exit(1);
    }
}
开发者ID:pandyxu,项目名称:enhanced-redis-event-lib,代码行数:25,代码来源:example.c

示例11: tWriteProc

void tWriteProc(struct aeEventLoop* eventLoop, int fd, void* clientData, int mask) {
    char pageBuf[512] = {0};
    char contentBuf[256] = {0};
    client_data_t *c = (client_data_t *)clientData;

    snprintf(contentBuf,
        sizeof(contentBuf),
        "<html>Hello, <a href=\"https://github.com/pandyxu/enhanced-redis-event-lib\">enhanced-redis-event-lib</a> example.<br /><br />%s</html>",
        server.backgroundBuf);

    snprintf(pageBuf, sizeof(pageBuf),
        "HTTP/1.1 200 OK\r\nContent-Length: %ld\r\n\r\n%s",
        strlen(contentBuf), contentBuf);
    int data_size = strlen(pageBuf);

    size_t available = sizeof(c->writeBuf)-c->writeBufPos;
    if (data_size > available)
    {
        ERRLOG("writeBuf not enough.");
        aeDeleteFileEvent(eventLoop, fd, AE_WRITABLE);
        free_client(c);
        return;
    }

    memcpy(c->writeBuf+c->writeBufPos, pageBuf, data_size);
    c->writeBufPos += data_size;

    int nwritten = 0;
    while(c->writeBufPos > 0) {
        nwritten = write(fd, c->writeBuf + c->sentlen, c->writeBufPos - c->sentlen);
        if (nwritten <= 0)
        {
            break;
        }
        c->sentlen += nwritten;

        /* If the buffer was sent, set writeBufPos to zero to continue with
         * the remainder of the reply. */
        if (c->sentlen == c->writeBufPos) {
            c->writeBufPos = 0;
            c->sentlen = 0;
        }
    }

    if (nwritten == -1) {
        if (errno == EAGAIN) {
            nwritten = 0;
        } else {
            ERRLOG("Error writing to client: %s", strerror(errno));
            aeDeleteFileEvent(eventLoop, fd, AE_WRITABLE);
            free_client(c);
            return;
        }
    }

    aeDeleteFileEvent(eventLoop, fd, AE_WRITABLE);
    free_client(c);
}
开发者ID:pandyxu,项目名称:enhanced-redis-event-lib,代码行数:58,代码来源:example.c

示例12: WARNLOG

void CEclAgentExecutionServer::start(StringBuffer & codeDir)
{
    if (started)
    {
        WARNLOG("START called when already started\n");
        assert(false);
    }

    codeDirectory = codeDir;
    StringBuffer propertyFile = codeDirectory;
    addPathSepChar(propertyFile);
    propertyFile.append("agentexec.xml");

    Owned<IPropertyTree> properties;
    try
    {
        DBGLOG("AgentExec: Loading properties file '%s'\n", propertyFile.str());
        properties.setown(createPTreeFromXMLFile(propertyFile.str()));
    }
    catch (IException *e) 
    {
        EXCLOG(e, "Error processing properties file\n");
        throwUnexpected();
    }

    {
        //Build logfile from component properties settings
        Owned<IComponentLogFileCreator> lf = createComponentLogFileCreator(properties, "eclagent");
        lf->setCreateAliasFile(false);
        lf->setMsgFields(MSGFIELD_timeDate | MSGFIELD_msgID | MSGFIELD_process | MSGFIELD_thread | MSGFIELD_code);
        lf->beginLogging();
        PROGLOG("Logging to %s",lf->queryLogFileSpec());
    }

    //get name of workunit job queue
    StringBuffer sb;
    properties->getProp("@name", sb.clear());
    agentName.set(sb);
    if (!agentName.length())
    {
        ERRLOG("'name' not specified in properties file\n");
        throwUnexpected();
    }

    //get dali server(s)
    properties->getProp("@daliServers", daliServers);
    if (!daliServers.length())
    {
        ERRLOG("'daliServers' not specified in properties file\n");
        throwUnexpected();
    }

    started = true;
    Thread::start();
    Thread::join();
}
开发者ID:aa0,项目名称:HPCC-Platform,代码行数:56,代码来源:agentexec.cpp

示例13: create_proc_name

int
create_proc_name(char **name, char *host, int port, char *trailer)
{
  uint64_t usec;
  pid_t pid;
  struct timeval tv;
  int s, len, trailer_len = 0;
  char *client_name;
  char buf[256];

  if (host == NULL) {
    if (0 != gethostname(buf, sizeof(buf))) {
      ERRLOG(errno, "gethostname");
      return -1;
    }
    host = buf;
  }
  if (0 != gettimeofday(&tv, NULL)) {
    ERRLOG(errno, "gettimeofday");
    return -1;
  }
  usec = (uint64_t)tv.tv_sec * 1000000 + (uint64_t)tv.tv_usec;
  pid = getpid();

  len = 512;
  if (trailer) {
    trailer_len = strlen(trailer);
    len += trailer_len;
  }
  client_name = malloc(len);
  if (client_name == NULL) {
    ERRLOG(errno, "malloc");
    return -1;
  }
  memset(client_name, 0, len);
  s = snprintf(client_name, len, "%s:%d-%d-%llx", host, port, pid,
    (long long unsigned)usec);
  if (s <= 0 || s >= len) {
    free(client_name);
    return -1;
  }  
  if (trailer) {
    len -= s;
    if (trailer_len+2 >= len) {
      free(client_name);
      return -1;
    }
    client_name[s++] = '-';
    memcpy(&client_name[s], trailer, trailer_len+1);
  }
  
  *name = client_name;
  return 0;
}
开发者ID:jam2in,项目名称:arcus-misc,代码行数:54,代码来源:common.c

示例14: ptm_lib_init_msg

int ptm_lib_init_msg(ptm_lib_handle_t *hdl, int cmd_id, int type, void *in_ctxt,
		     void **out_ctxt)
{
	ptm_lib_msg_ctxt_t *p_ctxt;
	ptm_lib_msg_ctxt_t *p_in_ctxt = in_ctxt;
	csv_t *csv;
	csv_record_t *rec, *d_rec;

	/* Initialize csv for using discrete record buffers */
	csv = csv_init(NULL, NULL, PTMLIB_MSG_SZ);

	if (!csv) {
		ERRLOG("%s: Could not allocate csv \n", __FUNCTION__);
		return -1;
	}

	rec = _ptm_lib_encode_header(csv, NULL, 0, PTMLIB_MSG_VERSION, type,
				     cmd_id, hdl->client_name);

	if (!rec) {
		ERRLOG("%s: Could not allocate record \n", __FUNCTION__);
		csv_clean(csv);
		csv_free(csv);
		return -1;
	}

	p_ctxt = calloc(1, sizeof(*p_ctxt));
	if (!p_ctxt) {
		ERRLOG("%s: Could not allocate context \n", __FUNCTION__);
		csv_clean(csv);
		csv_free(csv);
		return -1;
	}

	p_ctxt->csv = csv;
	p_ctxt->cmd_id = cmd_id;
	p_ctxt->type = type;

	*(ptm_lib_msg_ctxt_t **)out_ctxt = p_ctxt;

	/* caller supplied a context to initialize with? */
	if (p_in_ctxt) {
		/* insert the hdr rec */
		rec = csv_record_iter(p_in_ctxt->csv);
		csv_clone_record(p_in_ctxt->csv, rec, &d_rec);
		csv_insert_record(csv, d_rec);
		/* insert the data rec */
		rec = csv_record_iter_next(rec);
		csv_clone_record(p_in_ctxt->csv, rec, &d_rec);
		csv_insert_record(csv, d_rec);
	}
	return 0;
}
开发者ID:Azure,项目名称:sonic-bcm-lkm,代码行数:53,代码来源:ptm_lib.c

示例15: assert

PlayQueue_s *playq_createPlayQueue(const long *nodeIdPtr, unsigned long numBuffers) {
    PlayQueue_s *playq = NULL;

    assert(numBuffers <= MAX_PLAYQ_BUFFERS);

    do {
        playq = calloc(1, sizeof(PlayQueue_s));
        if (!playq) {
            ERRLOG("no memory");
            break;
        }

        PQList_s *list = calloc(1, sizeof(PQList_s));
        playq->_internal = list;
        if (!list) {
            ERRLOG("no memory");
            break;
        }

        bool allocSuccess = true;
        for (unsigned long i=0; i<numBuffers; i++) {
            PQListNode_s *listNode = calloc(1, sizeof(PQListNode_s));
            LOG("CREATING PlayNode_s node ID: %ld", nodeIdPtr[i]);
            listNode->node.nodeId = nodeIdPtr[i];
            if (!listNode) {
                ERRLOG("no memory");
                allocSuccess = false;
                break;
            }
            listNode->next = list->availNodes;
            list->availNodes = listNode;
        }
        if (!allocSuccess) {
            break;
        }

        playq->Enqueue = &playq_enqueue;
        playq->Dequeue = &playq_dequeue;
        playq->Remove  = &playq_remove;
        playq->Drain   = &playq_drain;
        playq->GetHead = &playq_getHead;
        playq->Get     = &playq_get;
        playq->CanEnqueue = &playq_canEnqueue;

        return playq;
    } while (0);

    if (playq) {
        playq_destroyPlayQueue(&playq);
    }

    return NULL;
}
开发者ID:jvernet,项目名称:apple2,代码行数:53,代码来源:playqueue.c


注:本文中的ERRLOG函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。