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


C++ slog函数代码示例

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


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

示例1: do_packet

static void
do_packet(connection_t *cptr, char *buf)
{
        char *ptr, buf2[BUFSIZE * 2];
        static char tmp[BUFSIZE * 2 + 1];

        while ((ptr = strchr(buf, '\n')))
        {
                snprintf(buf2, (BUFSIZE * 2), "%s%s", tmp, buf);
                *tmp = '\0';

		slog(LG_DEBUG, "-{incoming}-> %s", buf2);
		sendq_add(cptr, buf2, strlen(buf2));

                buf = ptr + 1;
        }

        if (*buf)
        {
                mowgli_strlcpy(tmp, buf, BUFSIZE * 2);
                tmp[BUFSIZE * 2] = '\0';
        }
}
开发者ID:atheme,项目名称:atheme-contrib-modules,代码行数:23,代码来源:gen_echoserver.c

示例2: susb_handle_event

static void susb_handle_event(struct aura_node *node, enum node_event evt, const struct aura_pollfds *fd)
{
	struct aura_buffer *buf;
	struct usb_dev_info *inf = aura_get_transportdata(node);

	ncusb_handle_events_nonblock_once(node, inf->ctx, inf->timer);

	if (inf->cbusy)
		return;

	if (evt == NODE_EVENT_STARTED) {
		aura_etable_activate(inf->etbl);
		/* Activate our export table
		 * Hack: Since libusb tends to send and receive data in one buffer,
		 * we need to adjust argument buffer to fit in return values as well.
		 * It helps us to avoid needless copying.
		 */
		int i;
		for (i = 0; i < inf->etbl->next; i++) {
			struct aura_object *tmp;
			tmp = &inf->etbl->objects[i];
			tmp->arglen += tmp->retlen;
		}
		inf->etbl = NULL;
		ncusb_watch_for_device(inf->ctx, &inf->dev_descr);
		ncusb_start_descriptor_watching(node, inf->ctx);
		slog(1, SLOG_INFO, "usb: Now looking for a device %x:%x %s/%s/%s",
		     inf->dev_descr.vid, inf->dev_descr.pid,
		     inf->dev_descr.vendor, inf->dev_descr.product, inf->dev_descr.serial);
	} else if (inf->state == SUSB_DEVICE_RESTART) {
		susb_offline_transport(inf);
	} else if (inf->state == SUSB_DEVICE_OPERATIONAL) {
		buf = aura_peek_buffer(&node->outbound_buffers);
		if (buf)
			susb_issue_call(node, buf);
	}
}
开发者ID:nekromant,项目名称:aura,代码行数:37,代码来源:transport-susb.c

示例3: usb_start_ops

static int usb_start_ops(struct libusb_device_handle *hndl, void *arg)
{
	/* FixMe: Reading descriptors is synchronos. This is not needed
	 * often, but leaves a possibility of a flaky usb device to 
	 * screw up the event processing.
	 * A proper workaround would be manually reading out string descriptors
	 * from a device in an async fasion in the background. 
	 */
	int ret;
	struct usb_dev_info *inf = arg;
	struct aura_node *node = inf->node; 

	inf->handle = hndl;
	
	libusb_fill_interrupt_transfer(inf->itransfer, inf->handle, 0x81,
				       inf->ibuffer, 8, 
				       cb_interrupt, node, 10000);

	libusb_fill_control_setup(inf->ctrlbuf, 
				  LIBUSB_REQUEST_TYPE_VENDOR | LIBUSB_RECIPIENT_DEVICE | LIBUSB_ENDPOINT_IN,
				  RQ_GET_DEV_INFO,
				  0, 0, inf->io_buf_size);
	libusb_fill_control_transfer(inf->ctransfer, inf->handle, inf->ctrlbuf, cb_got_dev_info, node, 1500);

	ret = libusb_submit_transfer(inf->ctransfer);
	if (ret!= 0) {
		libusb_close(inf->handle);
		return -1;
	}

	inf->state = AUSB_DEVICE_INIT; /* Change our state */
	inf->cbusy = true;

	slog(4, SLOG_DEBUG, "usb: Device opened, info packet requested");
	return 0;
};
开发者ID:RC-MODULE,项目名称:matlab,代码行数:36,代码来源:transport-usb.c

示例4: template_setup

void template_setup (GuTemplate* t) {
    const gchar *filename;
    char *filepath = NULL;
    GError *error = NULL;
    GtkTreeIter iter;

    gchar *dirpath = g_build_filename (g_get_user_config_dir (), "gummi",
                                      "templates" , NULL);

    GDir* dir = g_dir_open (dirpath, 0, &error);
    if (error) {
        /* print error if directory does not exist */
        slog (L_INFO, "unable to read template directory, creating new..\n");
        g_mkdir_with_parents (dirpath, DIR_PERMS);
        g_free (dirpath);
        return;
    }

    while ( (filename = g_dir_read_name (dir))) {
        filepath = g_build_filename (dirpath, filename, NULL);
        gtk_list_store_append (t->list_templates, &iter);
        gtk_list_store_set (t->list_templates, &iter, 0, filename, 1,
                filepath, -1);
        g_free (filepath);
    }
    g_free (dirpath);

    // disable the add button when there are no tabs opened (#388)
    if (!tabmanager_has_tabs()) {
        gtk_widget_set_sensitive (t->template_add, FALSE);
    }

    gtk_widget_set_sensitive (t->template_open, FALSE);


}
开发者ID:abhi-kumar,项目名称:gummi,代码行数:36,代码来源:template.c

示例5: actor_empty_list

void actor_empty_list()
{
	int i;
	Actor *actor = NULL;
	if(!actorList)
	{
		slog("actorList not initialized");
		return;
	}
	for(i = 0; i < actorMax; ++i)
	{
		actor = &actorList[i];
		actor_free(&actor);
	}
	memset(actorList, 0, sizeof(Actor) * actorMax);
	for(i = 0; i < actorMax; i++)
	{
		if(actorList[i].sprite != NULL)
		{
			sprite_free(&actorList[i].sprite);
		}
	}
	actorNum = 0;
}
开发者ID:egilmore533,项目名称:IT-276-Pep-s-Spicy-Adventure-,代码行数:24,代码来源:actor.c

示例6: user_delete

/*
 * user_delete(user_t *u, const char *comment)
 *
 * Destroys a user object and deletes the object from the users DTree.
 *
 * Inputs:
 *     - user object to delete
 *     - quit comment
 *
 * Outputs:
 *     - nothing
 *
 * Side Effects:
 *     - on success, a user is deleted from the users DTree.
 */
void user_delete(user_t *u, const char *comment)
{
	mowgli_node_t *n, *tn;
	chanuser_t *cu;
	mynick_t *mn;
	char oldnick[NICKLEN];
	bool doenforcer = false;

	return_if_fail(u != NULL);

	if (u->flags & UF_DOENFORCE)
	{
		doenforcer = true;
		mowgli_strlcpy(oldnick, u->nick, sizeof oldnick);
		u->flags &= ~UF_DOENFORCE;
	}

	if (!comment)
		comment = "";

	slog(LG_DEBUG, "user_delete(): removing user: %s -> %s (%s)", u->nick, u->server->name, comment);

	hook_call_user_delete_info((&(hook_user_delete_t){ .u = u,
				.comment = comment}));
开发者ID:Canternet,项目名称:atheme,代码行数:39,代码来源:users.c

示例7: obj_va_search

int obj_va_search(float *v,float *a,int count,float vtarget[3],float atarget[6])
{
    int i;
    if (!v || !a)
    {
        slog("error, missing a buffer to search");
        return -1;/*not found*/
    }
    for (i = 0; i < count; i++)
    {
        if (memcmp(&v[i * 3],vtarget,sizeof(float)*3) != 0)
        {
            /*not equal, keep searching*/
            continue;
        }
        if (memcmp(&a[i * 3],atarget,sizeof(float)*6) != 0)
        {
            /*not equal, keep searching*/
            continue;
        }
        return i;
    }
    return -1;/*not found*/
}
开发者ID:Clodial,项目名称:GummyShips2,代码行数:24,代码来源:obj.c

示例8: font_draw_text

void font_draw_text(
    char   * text,
    int   x,
    int   y,
    Vec3D  color,
    float alpha,
    Uint32   size
  )
{
  if (!font_initialized())return;
  if (size >= FontSizeMax)
  {
    slog("font: passed a font size outside of available range");
    return;
  }
  font_draw_text_custom(
    text,
    x,
    y,
    color,
    alpha,
    __font_size[size]
  );
}
开发者ID:PhoenixLord1010,项目名称:Flight64,代码行数:24,代码来源:font.c

示例9: audio_empty_pak_list

void audio_empty_pak_list()
{
	int i;
	SoundPak *pak = NULL;
	if(!pakList)
	{
		slog("pakList not initialized");
		return;
	}
	for(i = 0; i < maxPaks; ++i)
	{
		pak = &pakList[i];
		audio_pak_free(&pak);
	}
	memset(pakList, 0, sizeof(SoundPak) * maxPaks);
	for(i = 0; i < maxPaks; ++i)
	{
		pakList[i].moving = NULL;
		pakList[i].firing1 = NULL;
		pakList[i].firing2 = NULL;
		pakList[i].death = NULL;
	}
	numPaks = 0;
}
开发者ID:egilmore533,项目名称:IT-276-Pep-s-Spicy-Adventure-,代码行数:24,代码来源:audio.c

示例10: m_tburst

static void m_tburst(sourceinfo_t *si, int parc, char *parv[])
{
	time_t chants = atol(parv[0]);
	channel_t *c = channel_find(parv[1]);
	time_t topicts = atol(parv[2]);
 
	if (c == NULL)
		return;

	/* Our uplink is trying to change the topic during burst,
	 * and we have already set a topic. Assume our change won.
	 * -- jilles */
	if (si->s != NULL && si->s->uplink == me.me &&
			!(si->s->flags & SF_EOB) && c->topic != NULL)
		return;

	if (c->ts < chants || (c->ts == chants && c->topicts >= topicts))
	{
		slog(LG_DEBUG, "m_tburst(): ignoring topic on %s", c->name);
		return;
	}

	handle_topic_from(si, c, parv[3], topicts, parv[4]);
}
开发者ID:ItsAGeekThing,项目名称:Xtheme,代码行数:24,代码来源:hybrid.c

示例11: main

/* main routine */
int main(int argc, char **argv)
{
        int listenfd, r;
        unsigned short port;
        struct sockaddr_in serv;
        int mode;
        int *log_level;

        signal(SIGPIPE, SIG_IGN);
        log_level = shmalloc("/log_level", sizeof(int));
        if (!log_level) {
                slog(SLOG_ERROR, "could not allocate shm for slog");
                exit(EXIT_FAILURE);
        }
        *log_level = SLOG_ALL;
        slog_level(log_level);

        if (argc < 2) {
                fprintf(stderr, "Usage: %s <port number> "
                                "[mode: 0=seq,1=thr,2=proc]\n", argv[0]);
                exit(EXIT_FAILURE);
        } else if (argc >= 3) {
                mode = atoi(argv[2]);
                if (argc >= 4) {
                        *log_level = atoi(argv[3]);
                        fprintf(stderr, "%s: *log_level = %d\n",
                                argv[0], *log_level);
                }

        } else {
                fprintf(stderr, "%s: no mode specified. "
                                "defaulting to mode=0 (seq)\n", argv[0]);
                mode = 0;
        }

        if ((port = atoi(argv[1])) <= 0) {
                fprintf(stderr, "%s: bad port\n", argv[0]); 
                exit(EXIT_FAILURE);
        }

        listenfd = socket(AF_INET, SOCK_STREAM, 0);
        if (listenfd == -1) {
                slog_perror("socket");
                exit(EXIT_FAILURE);
        }


        memset(&serv, 0, sizeof(serv));
        serv.sin_family = AF_INET;
        serv.sin_addr.s_addr = htonl(INADDR_ANY);
        serv.sin_port = htons(port);

        r = bind(listenfd, (struct sockaddr *)&serv, sizeof(serv));
        if (r == -1) {
                slog_perror("bind");
                exit(EXIT_FAILURE);
        }

        r = listen(listenfd, LISTENQ);
        if (r == -1) {
                slog_perror("listen");
                exit(EXIT_FAILURE);
        }

        if (mode == 0) {
                proxy_seq(listenfd);
        } else if (mode == 1) {
                proxy_thr(listenfd);
        } else {
                proxy_proc(listenfd);
        }

        r = close(listenfd);
        if (r == -1) {
                slog_perror("close"); 
                exit(EXIT_FAILURE);
        }

        shfree("/log_level", log_level, sizeof(int));
        exit(EXIT_SUCCESS);
}
开发者ID:wyc,项目名称:simple-http-proxy,代码行数:82,代码来源:proxy.c

示例12: main

int main(int argc, char *argv[])
{
	GList* list = NULL;
	json_t *root;

	SDL_Surface *optimized_surface = NULL;
	SDL_Surface *temp = NULL;
	Sound *bg_music = NULL;
	Sound *level_music = NULL;
	int done;
	const Uint8 *keys;
	char imagepath[512];

	game_initialize_system();
	SDL_ShowCursor(SDL_DISABLE);

	bg_music = sound_load_music("sounds/vanguard_bouncy.mp3");
	if(!bg_music)
	{
		slog("Could not load music\n");
	}
	
	level_music = sound_load_music("sounds/chippy_cloud_kid.mp3");
	if(!level_music)
	{
		slog("Could not load music\n");
	}
	Mix_VolumeMusic(5);

	if(temp)
	{
		optimized_surface = SDL_ConvertSurface( temp, graphics_surface->format, NULL );
		SDL_FreeSurface(temp);
		
	}

	SDL_Event e;
	done = 0;

	int lock = true;
	do
	{
		if(menu_flag)
		{
			menu_draw();
			if(lock == false)
			{
				Mix_HaltMusic();
				lock = true;
			}

			if(Mix_PlayingMusic() == 0)
			{
				Mix_PlayMusic(bg_music->music, -1);
			}
		}
		else
		{
			tilemap_render_tile();
			entity_draw_all();
			if(lock == true)
			{
				Mix_HaltMusic();
				lock = false;
			}

			if(Mix_PlayingMusic() == 0)
			{
				Mix_PlayMusic(level_music->music, -1);
			}
		}

		mouse_draw_self();

		graphics_next_frame();
		SDL_PumpEvents();

		entity_think_all();

		while(SDL_PollEvent(&e) != 0)
		{
			if(e.type == SDL_QUIT)
			{
				done = 1;
			}
			
			bool leftclick = false ;
			bool rightclick = false;
			if(e.type == SDL_MOUSEBUTTONDOWN)
			{
				if(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT))
				{
					leftclick = true;
				}
				else if(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_RIGHT))
				{
					rightclick = true;
				}
			}

//.........这里部分代码省略.........
开发者ID:yi7,项目名称:MouseAlert,代码行数:101,代码来源:game.c

示例13: slog

void 
D3Drender::render(void)
	{
        if (d3ddev == NULL) 
        { 
            #ifdef D3DSLOG
                slog("D3Drender render-- no device \n");
            #endif

             release(); 
             mHwnd = NULL;

            return; 
        }//endif

          d3ddev->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);

            d3ddev->BeginScene();

		        d3ddev->SetTexture(0, mtex.ptex);
		        d3ddev->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );
                d3ddev->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
                d3ddev->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );
                d3ddev->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_DISABLE );

                // select which vertex format we are using
                d3ddev->SetFVF(CUSTOMFVF);

                // select the vertex buffer to display
                d3ddev->SetStreamSource(0, v_buffer, 0, sizeof(CUSTOMVERTEX));

                //draw our quad
		        d3ddev->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 2);

            d3ddev->EndScene();

             d3ddev->Present(NULL, NULL, NULL, NULL);

            //check if the device was lost (but not every render)
             //i have yet to encounter any of these log messages
             //so far device loss seem to be just d3ddev  becoming NULL
            wait += 1;
            if (wait >= 5)
            { 
                wait = 0;

                HRESULT coopResult;
                coopResult = d3ddev->TestCooperativeLevel();

                if (coopResult == D3DERR_DEVICELOST)
                { slog("D3DRender  D3DERR_DEVICELOST \n"); }

                if (coopResult == D3DERR_DEVICENOTRESET)
                { slog("D3DRender  D3DERR_DEVICENOTRESET \n"); }
 
                if (coopResult == D3DERR_DRIVERINTERNALERROR)
                { slog("D3DRender  D3DERR_DRIVERINTERNALERROR \n"); }

                if ((coopResult == D3DERR_DEVICELOST ) || (coopResult == D3DERR_DEVICENOTRESET) || (coopResult == D3DERR_DRIVERINTERNALERROR) )
                {
                  release(); 
                  mHwnd = NULL;
                }//endif
            }//endif

	}//update
开发者ID:xsmart,项目名称:splayer,代码行数:66,代码来源:D3Drender.cpp

示例14: sperror

void sperror(char *message) {
	slog(LOG_ERROR, "%s: %s\n", message, strerror(errno));
}
开发者ID:WuerthPhoenix,项目名称:safed,代码行数:3,代码来源:Misc.c

示例15: atheme_main

int atheme_main(int argc, char *argv[])
{
	int daemonize_pipe[2];
	bool have_conf = false;
	bool have_log = false;
	bool have_datadir = false;
	char buf[32];
	int pid, r;
	FILE *pid_file;
	const char *pidfilename = RUNDIR "/atheme.pid";
	char *log_p = NULL;
	mowgli_getopt_option_t long_opts[] = {
		{ NULL, 0, NULL, 0, 0 },
	};

	atheme_bootstrap();

	/* do command-line options */
	while ((r = mowgli_getopt_long(argc, argv, "c:dhrl:np:D:v", long_opts, NULL)) != -1)
	{
		switch (r)
		{
		  case 'c':
			  config_file = sstrdup(mowgli_optarg);
			  have_conf = true;
			  break;
		  case 'd':
			  log_force = true;
			  break;
		  case 'h':
			  print_help();
			  exit(EXIT_SUCCESS);
			  break;
		  case 'r':
			  readonly = true;
			  break;
		  case 'l':
			  log_p = sstrdup(mowgli_optarg);
			  have_log = true;
			  break;
		  case 'n':
			  runflags |= RF_LIVE;
			  break;
		  case 'p':
			  pidfilename = mowgli_optarg;
			  break;
		  case 'D':
			  datadir = mowgli_optarg;
			  have_datadir = true;
			  break;
		  case 'v':
			  print_version();
			  exit(EXIT_SUCCESS);
			  break;
		  default:
			  printf("usage: atheme [-dhnvr] [-c conf] [-l logfile] [-p pidfile]\n");
			  exit(EXIT_FAILURE);
			  break;
		}
	}

	if (!have_conf)
		config_file = sstrdup(SYSCONFDIR "/atheme.conf");

	if (!have_log)
		log_p = sstrdup(LOGDIR "/atheme.log");

	if (!have_datadir)
		datadir = sstrdup(DATADIR);

	cold_start = true;

	runflags |= RF_STARTING;

	atheme_init(argv[0], log_p);

	slog(LG_INFO, "%s is starting up...", PACKAGE_STRING);

	/* check for pid file */
#ifndef MOWGLI_OS_WIN
	if ((pid_file = fopen(pidfilename, "r")))
	{
		if (fgets(buf, 32, pid_file))
		{
			pid = atoi(buf);

			if (!kill(pid, 0))
			{
				fprintf(stderr, "atheme: daemon is already running\n");
				exit(EXIT_FAILURE);
			}
		}

		fclose(pid_file);
	}
#endif

	if (!(runflags & RF_LIVE))
		daemonize(daemonize_pipe);

//.........这里部分代码省略.........
开发者ID:Acidburn0zzz,项目名称:atheme,代码行数:101,代码来源:atheme.c


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