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


C++ ShowLog函数代码示例

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


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

示例1: wpool_init

static void wpool_init(WTHREAD *wp,int num)
{
int i;
	if(wp->QP) return;
	wp->QP=(Qpool *)malloc(num * sizeof(Qpool));
	if(!wp->QP) {
		ShowLog(1,"%s:QP malloc error!",__FUNCTION__);
		wp->poolnum=0;
		return;
	}
	wp->poolnum=num;
	for(i=0;i<wp->poolnum;i++) {
		wp->QP[i].queue=NULL;
		wp->QP[i].tid=0;
		pthread_mutex_init(&wp->QP[i].mut,NULL);
		pthread_cond_init(&wp->QP[i].cond,NULL);
	}
	
        i=pthread_attr_setdetachstate(&wp->attr,PTHREAD_CREATE_DETACHED);
        if(i) {
                ShowLog(1,"%s:can't set pthread attr PTHREAD_CREATE_DETACHED:%s",
			__FUNCTION__,strerror(i));
        }
//设置线程堆栈保护区 16K
        pthread_attr_setguardsize(&wp->attr,(size_t)(1024 * 16));

}
开发者ID:hx71105417,项目名称:sdbc_linux,代码行数:27,代码来源:mod_sc.c

示例2: main

int main(int ac,char *av[])
{
int i;
struct rlimit sLimit;

//设置可以core dumpped
        sLimit.rlim_cur = -1;
        sLimit.rlim_max = -1;
        i=setrlimit(RLIMIT_CORE,(const struct rlimit *)&sLimit);

	if(ac>1){
		envcfg(av[1]);
	}
	sprintf(myshowid,"%s:%d",sc_basename(av[0]),getpid());
	Showid=myshowid;
	i=scpool_init(0);
	if(i<=0) {
		ShowLog(1,"scpool_init err=%d",i);
		return 1;
	}
	ShowLog(2,"scpool %d",i);
	TPOOL_srv(netinit,quit,scpool_check,sizeof(GDA));
	quit(0);
	return 0;
}
开发者ID:hx71105417,项目名称:sdbc_linux,代码行数:25,代码来源:midsc.c

示例3: FileTypeOf

cbDebuggerPlugin::SyncEditorResult cbDebuggerPlugin::SyncEditor(const wxString& filename, int line, bool setMarker)
{
    if (setMarker)
    {
        EditorManager* edMan = Manager::Get()->GetEditorManager();
        for (int i = 0; i < edMan->GetEditorsCount(); ++i)
        {
            cbEditor* ed = edMan->GetBuiltinEditor(i);
            if (ed)
                ed->SetDebugLine(-1);
        }
    }
    FileType ft = FileTypeOf(filename);
    if (ft != ftSource && ft != ftHeader && ft != ftResource)
    {
        // if the line is >= 0 and ft == ftOther assume, that we are in header without extension
        if (line < 0 || ft != ftOther)
        {
            ShowLog(false);
            Log(_("Unknown file: ") + filename, Logger::error);
            InfoWindow::Display(_("Unknown file"), _("File: ") + filename, 5000);

            return SyncFileUnknown; // don't try to open unknown files
        }
    }

    cbProject* project = Manager::Get()->GetProjectManager()->GetActiveProject();
    ProjectFile* f = project ? project->GetFileByFilename(filename, false, true) : nullptr;

    wxString unixfilename = UnixFilename(filename);
    wxFileName fname(unixfilename);

    if (project && fname.IsRelative())
        fname.MakeAbsolute(project->GetBasePath());

    // gdb can't work with spaces in filenames, so we have passed it the shorthand form (C:\MYDOCU~1 etc)
    // revert this change now so the file can be located and opened...
    // we do this by calling GetLongPath()
    cbEditor* ed = Manager::Get()->GetEditorManager()->Open(fname.GetLongPath());
    if (ed)
    {
        ed->Show(true);
        if (f && !ed->GetProjectFile())
            ed->SetProjectFile(f);
        ed->GotoLine(line - 1, false);
        if (setMarker)
            ed->SetDebugLine(line - 1);
        return SyncOk;
    }
    else
    {
        ShowLog(false);
        Log(_("Cannot open file: ") + filename, Logger::error);
        InfoWindow::Display(_("Cannot open file"), _("File: ") + filename, 5000);

        return SyncFileNotFound;
    }
}
开发者ID:DowerChest,项目名称:codeblocks,代码行数:58,代码来源:cbplugin.cpp

示例4: sc_connect

//连接
static int sc_connect(pool *p1,resource *rs)
{
int ret=-1;
T_NetHead Head;
struct utsname ubuf;
char buf[200],*p,addr[20];
log_stu logs;

	rs->Conn.timeout=-1;
	ret=Net_Connect(&rs->Conn,&rs->cli,*p1->log.family?p1->family:NULL);
	if(ret) {
		rs->cli.Errno=errno;
		stptok(strerror(errno),rs->cli.ErrMsg,sizeof(rs->cli.ErrMsg),0);
		return -1;
	}
//login
	uname(&ubuf);
	p=buf;
	Head.O_NODE=LocalAddr(rs->Conn.Socket,addr);
	p+=sprintf(p,"%s|%s|%s,%s|||",p1->log.DEVID,p1->log.LABEL,
		ubuf.nodename,addr);
	rs->Conn.MTU=p1->log.MTU;
	Head.PROTO_NUM=0;
	Head.D_NODE=p1->log.NEXT_d_node;
	Head.ERRNO1=rs->Conn.MTU;
	Head.ERRNO2=Head.PKG_REC_NUM=0;
	Head.data=buf;
	Head.PKG_LEN=strlen(Head.data);
	ret=SendPack(&rs->Conn,&Head);
	ret=RecvPack(&rs->Conn,&Head);
	if(ret) {
		rs->cli.Errno=errno;
		stptok(strerror(errno),rs->cli.ErrMsg,sizeof(rs->cli.ErrMsg),0);
		disconnect(&rs->Conn);
		ShowLog(1,"%s:network error %d,%s",__FUNCTION__,rs->cli.Errno,rs->cli.ErrMsg);
		rs->cli.Errno=-1;
		return -2;
	}
	if(Head.ERRNO1 || Head.ERRNO2) {
		ShowLog(1,"%s:login error ERRNO1=%d,ERRNO2=%d,%s",__FUNCTION__,
			Head.ERRNO1,Head.ERRNO2,Head.data);
		disconnect(&rs->Conn);
		stptok(Head.data,rs->cli.ErrMsg,sizeof(rs->cli.ErrMsg),0);
		rs->cli.Errno=-1;
		return -3;
	}
	net_dispack(&logs,Head.data,log_tpl);
	strcpy(rs->cli.DBOWN,logs.DBOWN);
	strcpy(rs->cli.UID,logs.DBUSER);
//取服务名
	ret=init_svc_no(&rs->Conn);
	rs->cli.Errno=ret;
	*rs->cli.ErrMsg=0;
	return ret;
}
开发者ID:hx71105417,项目名称:sdbc_linux,代码行数:56,代码来源:scpool_n.c

示例5: login_finish

static int login_finish(T_Connect *conn,T_NetHead *NetHead)
{
char *cp;
T_SRV_Var *up=(T_SRV_Var *)conn->Var;
GDA *gp=(GDA *)up->var;
T_CLI_Var *clip;
char tmp[30],tmp1[256];

	unset_callback(up->TCB_no);
//	up->poolno=get_scpool_no(NetHead->D_NODE);
/* 怎么认证还得想办法
	cp=get_LABEL(up->poolno);
	if(!cp || strcmp(cp,logrec.label)) {
		sprintf(tmp1,"错误的DBLABEL %s",logrec.label);
		goto errret;
	}
*/
	if(!gp->server) {
		sprintf(tmp1,"%s:connect to server fault,TCB:%d",
			__FUNCTION__,up->TCB_no);
		ShowLog(1,"%s:Error:%s",__FUNCTION__,tmp1);
                NetHead->ERRNO1=-1;
                NetHead->ERRNO2=-1;
                NetHead->PKG_REC_NUM=0;
                NetHead->data=tmp1;
                NetHead->PKG_LEN=strlen(NetHead->data);
                SendPack(conn,NetHead);
                return 0; // fail
	}
	clip=(T_CLI_Var *)gp->server->Var;
	if(clip) {
//		stptok(clip->UID,up->SQL_Connect.UID,sizeof(up->SQL_Connect.UID),0);
//		stptok(clip->DBOWN,up->SQL_Connect.DBOWN,sizeof(up->SQL_Connect.DBOWN),0);
	}
ShowLog(5,"%s:TCB:%d,poolno=%d,Errno=%d",__FUNCTION__,up->TCB_no,up->poolno,clip->Errno);
	release_SC_connect(&gp->server,up->TCB_no,up->poolno);
	cp=tmp1;
	if(clip) cp+=sprintf(cp,"%s|%s|%s|%s|",
			gp->devid,gp->operid ,clip->UID,clip->DBOWN);

	else cp+=sprintf(cp,"%s|%s|||", gp->devid,gp->operid);
	cp+=sprintf(cp,"%s|%d|",rsecstrfmt(tmp,now_sec(),YEAR_TO_SEC),up->TCB_no);
	ShowLog(2,"%s:%s Login success",__FUNCTION__,tmp1);

	NetHead->data=tmp1;
	NetHead->PKG_LEN=strlen(NetHead->data);
	NetHead->ERRNO1=0;
	NetHead->ERRNO2=0;
	NetHead->PKG_REC_NUM=0;
    	SendPack(conn,NetHead);
	return 1;
}
开发者ID:hx71105417,项目名称:sdbc_linux,代码行数:52,代码来源:login.c

示例6: quit

void quit(int n)
{
	ShowLog(0,"quit %d!\n",n);
/***********************************
 * close logfile
 ***********************************/
	if(n<0) n=-n;
	wpool_free();
	scpool_free();
	tpool_free();
	ShowLog(-1,0);
	exit(n&255);
}
开发者ID:hx71105417,项目名称:sdbc_linux,代码行数:13,代码来源:midsc.c

示例7: DatabaseConnectionDialog

 void DatabaseConnectionWindow::ActivateWindow()
 {
     if(!_DatabaseConnectionDialog)
     {
         _DatabaseConnectionDialog = new DatabaseConnectionDialog();
         connect(_DatabaseConnectionDialog,SIGNAL(RunWithoutDatabase()),this,SIGNAL(ContinueWithoutDatabase()));
         connect(_DatabaseConnectionDialog,SIGNAL(Close()),this,SIGNAL(Cancel()));
         connect(_DatabaseConnectionDialog,SIGNAL(ShowLog()),this,SIGNAL(ShowLog()));
         if(NewLabel.length() > 0)
             _DatabaseConnectionDialog->SetLabel(NewLabel);
         _DatabaseConnectionDialog->show();
     }
 }
开发者ID:bablosoft,项目名称:BAS,代码行数:13,代码来源:databaseconnectionwindow.cpp

示例8: release_SC_connect

//归还数据库连接  
void release_SC_connect(T_Connect **Connect,int TCBno,int n)
{
int i,num;
pthread_t tid=pthread_self();
pool *pl;
resource *rs;
T_CLI_Var *clip;
//ShowLog(5,"%s:TCB:%d,poolno=%d",__FUNCTION__,TCBno,n);
	if(!Connect || !scpool || n<0 || n>=SCPOOLNUM) {
		ShowLog(1,"%s:TCB:%d,poolno=%d,错误的参数",__FUNCTION__,TCBno,n);
		return;
	}
	if(!*Connect) {
		ShowLog(1,"%s:TCB:%d,Conn is Empty!",__FUNCTION__,TCBno);
		return;
	}
	clip=(T_CLI_Var *)((*Connect)->Var);
	pl=&scpool[n];
	rs=pl->lnk;
	if(!rs) {
		ShowLog(1,"%s:无效的连接池[%d]",__FUNCTION__,n);
		return;
	}
	num=pl->resource_num;
	for(i=0;i<num;i++,rs++) if(TCBno==rs->TCBno) {
		if(0!=pthread_mutex_lock(&pl->mut)) {
			ShowLog(1,"%s:pool[%d].%d,TCB:%d,mutex error=%d,%s",
				__FUNCTION__,n,i,TCBno,errno,strerror(errno));
			return;
		}
if(*Connect != &rs->Conn) {
	ShowLog(1,"%s:TCB:%d,Connect not equal!",__FUNCTION__,TCBno);
}
if(clip != &rs->cli) {
	ShowLog(1,"%s:TCB:%d,clip not equal!",__FUNCTION__,TCBno);
}
		if(rs->cli.Errno==-1) {  //连接失效
ShowLog(1,"%s:scpool[%d].%d fail!",__FUNCTION__,n,i);
			disconnect(&rs->Conn);
		}
		rs->TCBno=-1;
		pthread_mutex_unlock(&pl->mut);
		pthread_cond_signal(&pl->cond); //如果有等待连接的线程就唤醒它 
  		rs->timestamp=now_usec();
		clip->Errno=0;
		*clip->ErrMsg=0;
		*Connect=NULL;
		if(log_level) ShowLog(log_level,"%s tid=%lu,TCB:%d,pool[%d].lnk[%d]",__FUNCTION__,
				tid,TCBno,n,i);
		return;
	}
ShowLog(1,"%s:在pool[%d]中未发现该TCBno:%d",__FUNCTION__,n,TCBno);
	clip->Errno=0;
	*clip->ErrMsg=0;
	*Connect=NULL;
}
开发者ID:hx71105417,项目名称:sdbc_linux,代码行数:57,代码来源:scpool_old.c

示例9: showpack

static void showpack(int lever,char *str,int i)
{
int j,k;
char errbuf[512];
	while(i>64) {
		i-=64;
		k=0;
		for(j=0;j<64;j++) k+=sprintf(errbuf+k,"%02X ",*str++ & 255);
		ShowLog(lever,"%s",errbuf);
	}
	k=0;
	for(j=0;j<i;j++) k+=sprintf(errbuf+k,"%02X ",*str++ & 255);
	ShowLog(lever,"%s",errbuf);
}
开发者ID:hx71105417,项目名称:sdbc_linux,代码行数:14,代码来源:net_pkg.c

示例10: scpool_check

//连接池监控 
void scpool_check()
{
int n,i,num;
pool *pl;
resource *rs;
INT64 now;
char buf[32];
T_Connect *conn=NULL;

	if(!scpool) return;
	now=now_usec();
	pl=scpool;

	for(n=0;n<SCPOOLNUM;n++,pl++) {
		if(!pl->lnk) continue;
		rs=pl->lnk;
		num=pl->resource_num;
		if(log_level) ShowLog(log_level,"%s:scpool[%d],num=%d",__FUNCTION__,n,num);
		pthread_mutex_lock(&pl->mut);
		for(i=0;i<num;i++,rs++) if(rs->TCBno<0) {
			if(rs->Conn.Socket>-1 && (now-rs->timestamp)>299000000) {
//空闲时间太长了     
				disconnect(&rs->Conn);
				rs->cli.Errno=-1;
				if(log_level)
					ShowLog(log_level,"%s:Close SCpool[%d].lnk[%d],since %s",__FUNCTION__,
					n,i,rusecstrfmt(buf,rs->timestamp,YEAR_TO_USEC));
			}
		} else {
			if(rs->Conn.Socket>-1 && (now-rs->timestamp)>299000000) {
//占用时间太长了     
				if(-1==get_TCB_status(rs->TCBno)) {
				//TCB已经结束,释放之
					if(log_level) ShowLog(log_level,"%s:scpool[%d].lnk[%d] TCB:%d to be release",
						__FUNCTION__,n,i,rs->TCBno);
					rs->cli.Errno=-1;
					conn=&rs->Conn;
					release_SC_connect(&conn,rs->TCBno,n);
				} else {
				    if(log_level) ShowLog(log_level,"%s:scpool[%d].lnk[%d] used by TCB:%d,since %s",
					__FUNCTION__,n,i,rs->TCBno,
					rusecstrfmt(buf,rs->timestamp,YEAR_TO_USEC));
				}
			}
		}
		pthread_mutex_unlock(&pl->mut);
	}
}
开发者ID:hx71105417,项目名称:sdbc_linux,代码行数:49,代码来源:scpool_n.c

示例11: scpool_MGR

int scpool_MGR(int TCBno,int poolno,T_Connect **connp,int (*call_back)(T_Connect *,T_NetHead *))
{
int ret;
pthread_t *tp;

	if(TCBno<0) {
		ShowLog(1,"%s:bad TCB no!",__FUNCTION__);
		return -1;
	}
	ShowLog(3,"%s:get pool[%d],TCB_no=%d,tid:%lX,USEC=%llu",__FUNCTION__,
		poolno,TCBno,pthread_self(),now_usec());
	*connp=get_SC_connect(poolno,0);
	if(*connp == (T_Connect *)-1) {
		*connp=NULL;
		return -1;
	}
	if(*connp) {
		if((*connp)->only_do == (sdbcfunc)1) {
			(*connp)->only_do=call_back;
			TCB_add(NULL,TCBno); //加入到主任务队列
//ShowLog(5,"%s:tid=%lX,only_do=1,TCB_no=%d",__FUNCTION__,pthread_self(),TCBno);
			return 1;
		}
		return 0;
	}
	set_callback(TCBno,call_back,120);
	if(wpool.poolnum<=0) {
		ret=get_scpoolnum();
		pthread_mutex_lock(&wpool.mut);
		wpool_init(&wpool,ret);
		pthread_mutex_unlock(&wpool.mut);
	}
	if(poolno < 0 || poolno >= wpool.poolnum) {
		ShowLog(1,"%s:TCB_no=%d bad poolno %d,poolnum=%d",__FUNCTION__,
			TCBno,poolno,wpool.poolnum);
		return -1;
	}
	pthread_mutex_lock(&wpool.QP[poolno].mut);
	TCB_add(&wpool.QP[poolno].queue,TCBno);
	tp=&wpool.QP[poolno].tid;
	if(*tp==0) *tp=TCBno+1;
	pthread_mutex_unlock(&wpool.QP[poolno].mut);
//new thread
	if(*tp==(pthread_t)(TCBno+1)) {
		pthread_create(&wpool.QP[poolno].tid,&wpool.attr,wait_sc,(void *)(long)poolno);
	} else pthread_cond_signal(&wpool.QP[poolno].cond); //唤醒工作线程
	return 1;
}
开发者ID:hx71105417,项目名称:sdbc_linux,代码行数:48,代码来源:mod_sc.c

示例12: N_SQL_Exec

int  N_SQL_Exec(T_Connect *connect,char *cmd)
{
T_CLI_Var *clip=(T_CLI_Var *)connect->Var;
T_NetHead nethead;
int i;
	nethead.PROTO_NUM=get_srv_no(connect->Var,"SQL_Exec");
	if(nethead.PROTO_NUM==1) {
		ShowLog(1,"%s:服务不存在",__FUNCTION__);
		return FORMATERR;
	}
	nethead.O_NODE=clip->ctx_id;
	nethead.D_NODE=get_d_node();
	nethead.ERRNO1=0;
	nethead.ERRNO2=(connect->status>0)?PACK_STATUS:0;
	nethead.PKG_REC_NUM=0;
	nethead.data=cmd;
	nethead.PKG_LEN=strlen(nethead.data);
	i=SendPack(connect,&nethead);
	if(i)return i;
	i=RecvPack(connect,&nethead);
//ShowLog(5,"SQL_Exec:ret=%d,errno1=%d,len=%d:%s",i,nethead.ERRNO1,nethead.PKG_LEN,nethead.data);
	if(i){
		return i;
	}
	EventCatch(connect,nethead.PROTO_NUM);
	return GetError(connect,&nethead);
}
开发者ID:lipengyuntian,项目名称:sdbc,代码行数:27,代码来源:sqlc.c

示例13: ShowLog

int CUploadsWnd::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	m_bShowLog = TRUE; 
	
	if (FALSE == m_wndTasks.Create (this))
		return -1;

	if (FALSE == m_wndLog.Create (this))
		return -1;

	if (FALSE == m_wndSplitter.Create (AfxGetInstanceHandle (), m_hWnd, WST_HORIZONTAL))
		return -1;

	m_wndSplitter.SetWnd1 (m_wndTasks);
	m_wndSplitter.SetWnd2 (m_wndLog);
	m_wndSplitter.SetRatio (_App.View_SplitterRatio ("Uploads_T_L"));

	ShowLog (m_bShowLog);

	_UplsMgr.SetEventFunc (_UploadsMgrEvents, this);

	LoadAll ();
	m_wndTasks.OnUploadCountChanged ();

	SetTimer (1, 1000, NULL);
	
	return 0;
}
开发者ID:ratever930,项目名称:freedownload,代码行数:31,代码来源:UploadsWnd.cpp

示例14: N_SQL_EndTran

int  N_SQL_EndTran(T_Connect *connect,int TranFlag)
{
T_NetHead nethead;
T_CLI_Var *clip=(T_CLI_Var *)connect->Var;
int i;
	nethead.PROTO_NUM=get_srv_no(connect->Var,"SQL_EndTran");
	if(nethead.PROTO_NUM==1) {
		ShowLog(1,"%s:服务不存在",__FUNCTION__);
		return FORMATERR;
	}
	nethead.O_NODE=clip->ctx_id;
	nethead.D_NODE=get_d_node();
	if(TranFlag == TRANBEGIN) connect->status++;
	else connect->status--;
	nethead.ERRNO2=(connect->status>0)?PACK_STATUS:0;
	nethead.ERRNO1=TranFlag;
	nethead.PKG_REC_NUM=0;
	nethead.data=0;
	nethead.PKG_LEN=0;
	i=SendPack(connect,&nethead);
	if(i)return i;
	i=RecvPack(connect,&nethead);
	if(i)return i;
	EventCatch(connect,nethead.PROTO_NUM);
	return GetError(connect,&nethead);
}
开发者ID:lipengyuntian,项目名称:sdbc,代码行数:26,代码来源:sqlc.c

示例15: N_SQL_Fetch

int  N_SQL_Fetch(T_Connect *connect,int curno,char **data,int recnum)
{
T_CLI_Var *clip=(T_CLI_Var *)connect->Var;
T_NetHead nethead;
int i;
	nethead.PROTO_NUM=get_srv_no(connect->Var,"SQL_Fetch");
	if(nethead.PROTO_NUM==1) {
		ShowLog(1,"%s:服务不存在",__FUNCTION__);
		return FORMATERR;
	}
	nethead.O_NODE=clip->ctx_id;
	nethead.D_NODE=get_d_node();
	nethead.ERRNO2=PACK_STATUS;
	nethead.ERRNO1=curno;
/* recnum:进入时每次Fetch的记录数,0=全部记录,null=1条 */
	nethead.PKG_REC_NUM=recnum;
	nethead.data=0;
	nethead.PKG_LEN=0;
	i=SendPack(connect,&nethead);
	if(i<0)return i;
	i=RecvPack(connect,&nethead);
	if(i<0)return i;
	EventCatch(connect,nethead.PROTO_NUM);
	if(nethead.ERRNO1) return GetError(connect,&nethead);
	*data=nethead.data;
       	*((T_User_Var *)connect->Var)->ErrMsg=0;
       	((T_User_Var *)connect->Var)->Errno=nethead.ERRNO1;
/* colunm num */
	((T_User_Var *)connect->Var)->NativeError=nethead.ERRNO2;
/* 返回实际得到的记录数 */
	return nethead.PKG_REC_NUM;
}
开发者ID:lipengyuntian,项目名称:sdbc,代码行数:32,代码来源:sqlc.c


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