• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ print_timestamp函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: log_garbage

/* Log garbage sent by a client.
 */
void log_garbage(t_session *session) {
	int i, spaces = 2;
	FILE *fp;
	char str[TIMESTAMP_SIZE + IP_ADDRESS_SIZE];

	if ((session->config->garbage_logfile == NULL) || (session->request == NULL)) {
		return;
	}

	for (i = 0; i < session->bytes_in_buffer; i++) {
		if (session->request[i] == '\0') {
			if (spaces > 0) {
				session->request[i] = ' ';
				spaces--;
			} else {
				session->request[i] = '\r';
			}
		}
	}

	if ((fp = fopen(session->config->garbage_logfile, "a")) == NULL) {
		return;
	}

	ip_to_str(str, &(session->ip_address), IP_ADDRESS_SIZE);
	strcat(str, "|");
	print_timestamp(str + strlen(str));
	fprintf(fp, "%s%s"EOL, str, session->request);
	fclose(fp);
}
开发者ID:wdlth,项目名称:hiawatha,代码行数:32,代码来源:log.c


示例2: accept_msg

int accept_msg(const struct sockaddr_nl *who,
	       struct nlmsghdr *n, void *arg)
{
	FILE *fp = arg;

	if (timestamp)
		print_timestamp(fp);

	switch (n->nlmsg_type) {
	case RTM_NEWLINK:
	case RTM_DELLINK:
		if (prefix_banner)
			fprintf(fp, "[LINK]");

		return print_linkinfo(who, n, arg);

	case RTM_NEWNEIGH:
	case RTM_DELNEIGH:
		if (prefix_banner)
			fprintf(fp, "[NEIGH]");
		return print_fdb(who, n, arg);

	case 15:
		return show_mark(fp, n);

	default:
		return 0;
	}


}
开发者ID:SamB,项目名称:iproute2,代码行数:31,代码来源:monitor.c


示例3: wiimote_timestamp2logicaltime

static double wiimote_timestamp2logicaltime(t_wiimote*x, struct timespec*timestamp) {
  double pddelay=clock_gettimesince(x->baselogicaltime); /* how long in logical time since we have connected to the wii */
  double realdelay=0.;  /* how long (in ms) after we connected to the wiimote this timestamp appeared */
  double delay=0.;
  if(NULL==timestamp || NULL==x->basetime)
    return 0.; /* immediately */

  realdelay=
    (timestamp->tv_sec - x->basetime->tv_sec) * 1000. +
    (timestamp->tv_nsec - x->basetime->tv_nsec) / 1000000.;

  delay=realdelay-pddelay;

#if 0
  print_timestamp(timestamp, x->basetime);
  post("logical time: %f = %f - %f", clock_gettimesince(x->baselogicaltime), now, x->baselogicaltime);
#endif
  //post("diff = %f = %f - %f", realdelay-pddelay, realdelay, pddelay);

  if(delay<0) {
    return 0.;
  }

  return realdelay;
}
开发者ID:Angeldude,项目名称:pd,代码行数:25,代码来源:wiimote.c


示例4: xfrm_accept_msg

static int xfrm_accept_msg(const struct sockaddr_nl *who,
			   struct rtnl_ctrl_data *ctrl,
			   struct nlmsghdr *n, void *arg)
{
	FILE *fp = (FILE *)arg;

	if (timestamp)
		print_timestamp(fp);

	if (listen_all_nsid) {
		if (ctrl == NULL || ctrl->nsid < 0)
			fprintf(fp, "[nsid current]");
		else
			fprintf(fp, "[nsid %d]", ctrl->nsid);
	}

	switch (n->nlmsg_type) {
	case XFRM_MSG_NEWSA:
	case XFRM_MSG_DELSA:
	case XFRM_MSG_UPDSA:
	case XFRM_MSG_EXPIRE:
		xfrm_state_print(who, n, arg);
		return 0;
	case XFRM_MSG_NEWPOLICY:
	case XFRM_MSG_DELPOLICY:
	case XFRM_MSG_UPDPOLICY:
	case XFRM_MSG_POLEXPIRE:
		xfrm_policy_print(who, n, arg);
		return 0;
	case XFRM_MSG_ACQUIRE:
		xfrm_acquire_print(who, n, arg);
		return 0;
	case XFRM_MSG_FLUSHSA:
		xfrm_state_flush_print(who, n, arg);
		return 0;
	case XFRM_MSG_FLUSHPOLICY:
		xfrm_policy_flush_print(who, n, arg);
		return 0;
	case XFRM_MSG_REPORT:
		xfrm_report_print(who, n, arg);
		return 0;
	case XFRM_MSG_NEWAE:
		xfrm_ae_print(who, n, arg);
		return 0;
	case XFRM_MSG_MAPPING:
		xfrm_mapping_print(who, n, arg);
		return 0;
	default:
		break;
	}

	if (n->nlmsg_type != NLMSG_ERROR && n->nlmsg_type != NLMSG_NOOP &&
	    n->nlmsg_type != NLMSG_DONE) {
		fprintf(fp, "Unknown message: %08d 0x%08x 0x%08x\n",
			n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags);
	}
	return 0;
}
开发者ID:idosch,项目名称:iproute2,代码行数:58,代码来源:xfrm_monitor.c


示例5: accept_msg

int accept_msg(const struct sockaddr_nl *who,
	       struct nlmsghdr *n, void *arg)
{
	FILE *fp = (FILE*)arg;

	if (timestamp)
		print_timestamp(fp);

	if (n->nlmsg_type == RTM_NEWROUTE || n->nlmsg_type == RTM_DELROUTE) {
		print_route(who, n, arg);
		return 0;
	}
	if (n->nlmsg_type == RTM_NEWLINK || n->nlmsg_type == RTM_DELLINK) {
		ll_remember_index(who, n, NULL);
		print_linkinfo(who, n, arg);
		return 0;
	}
	if (n->nlmsg_type == RTM_NEWADDR || n->nlmsg_type == RTM_DELADDR) {
		print_addrinfo(who, n, arg);
		return 0;
	}
	if (n->nlmsg_type == RTM_NEWNEIGH || n->nlmsg_type == RTM_DELNEIGH) {
		print_neigh(who, n, arg);
		return 0;
	}
	if (n->nlmsg_type == RTM_NEWPREFIX) {
		print_prefix(who, n, arg);
		return 0;
	}
	if (n->nlmsg_type == RTM_NEWRULE || n->nlmsg_type == RTM_DELRULE) {
		print_rule(who, n, arg);
		return 0;
	}
	if (n->nlmsg_type == 15) {
		char *tstr;
		time_t secs = ((__u32*)NLMSG_DATA(n))[0];
		long usecs = ((__u32*)NLMSG_DATA(n))[1];
		tstr = asctime(localtime(&secs));
		tstr[strlen(tstr)-1] = 0;
		fprintf(fp, "Timestamp: %s %lu us\n", tstr, usecs);
		return 0;
	}
	if (n->nlmsg_type == RTM_NEWQDISC ||
	    n->nlmsg_type == RTM_DELQDISC ||
	    n->nlmsg_type == RTM_NEWTCLASS ||
	    n->nlmsg_type == RTM_DELTCLASS ||
	    n->nlmsg_type == RTM_NEWTFILTER ||
	    n->nlmsg_type == RTM_DELTFILTER)
		return 0;
	if (n->nlmsg_type != NLMSG_ERROR && n->nlmsg_type != NLMSG_NOOP &&
	    n->nlmsg_type != NLMSG_DONE) {
		fprintf(fp, "Unknown message: %08x %08x %08x\n",
			n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags);
	}
	return 0;
}
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:56,代码来源:ipmonitor.c


示例6: double_buffering_wait

// Wait for data to be read or written
void double_buffering_wait( double_buffering *b, which_buffer wh_buff )
{
	int i;
	ssize_t nbytes;
	// Which buffer
	aiocb_list *buff = wh_buff == IO_BUFF ? b->io_l : b->comp_l;

#if DEBUG
	printf("Waiting for %p\n%d operations issued\nLast chunk: %zu bytes\n", 
			buff, buff->issued, buff->aiocb_l[buff->issued-1]->aio_nbytes);
	fflush(stdout);
#endif
	for ( i = 0; i < buff->issued; i++ )
	{
		buff->aux_l[0] = (struct aiocb *)buff->aiocb_l[i];
#if DEBUG
	    printf("Waiting for chunk %d (of %d): %zu bytes\n", i, buff->issued, buff->aux_l[0]->aio_nbytes);
		printf("Start: "); print_timestamp();
		fflush(stdout);
#endif
		if ( aio_suspend( buff->aux_l, 1, NULL ) != 0 )
		{
			// perror("aio_suspend error");
			fprintf(stderr, "[ERROR] aio_suspend: %s", strerror(aio_error(buff->aux_l[0])));
			exit( EXIT_FAILURE );
		}

		nbytes = aio_return( (struct aiocb *)buff->aux_l[0] );
		if ( nbytes != buff->aux_l[0]->aio_nbytes )
		{
			fprintf(stderr, "[ERROR] aio_return: %s", strerror(aio_error(buff->aux_l[0])));
			// perror("aio_suspend error - data not read completely");
			printf("%zu bytes read/write - %zu bytes expected\n", nbytes, buff->aux_l[0]->aio_nbytes);
			exit( EXIT_FAILURE );
		}
#if DEBUG
		printf("End: "); print_timestamp();
		fflush(stdout);
#endif
	}
}
开发者ID:rforge,项目名称:genabel,代码行数:42,代码来源:double_buffering.c


示例7: np_conn_respond

void
np_conn_respond(Npreq *req)
{
	int n;
	Npconn *conn;
	Nptrans *trans;
	Npfcall *rc;

	trans = NULL;
	conn = req->conn;
	rc = req->rcall;
	pthread_mutex_lock(&conn->lock);
	if (conn->trans && !conn->resetting && rc) {
		if (conn->srv->debuglevel) {
			print_timestamp(stderr);
			fprintf(stderr, " >>> (%p) ", conn);
			np_printfcall(stderr, rc, conn->dotu);
			if ( req->tcall->encryptor )
				fprintf(stderr, " (encrypted)");
			fprintf(stderr, "\n");
		}

		if ( req->tcall->encryptor ) {	
			/* Request was encrypted => encrypt also the response */
			rc->encryptor = req->tcall->encryptor;
			rc = np_encrypt_fcall(rc);
			req->rcall = rc;
		}

		n = np_trans_write(conn->trans, rc->pkt, rc->size);
		if (n <= 0) {
			trans = conn->trans;
			conn->trans = NULL;
		}
	}

	np_conn_free_incall(req->conn, req->tcall);
	free(req->rcall);
	req->tcall = NULL;
	req->rcall = NULL;
	pthread_mutex_unlock(&conn->lock);

	if (conn->resetting) {
		pthread_mutex_lock(&conn->srv->lock);
		pthread_cond_broadcast(&conn->resetcond);
		pthread_mutex_unlock(&conn->srv->lock);
	}

	if (trans)
		np_trans_destroy(trans); /* np_conn_read_proc will take care of resetting */
}
开发者ID:novyzde3,项目名称:Test_clondike,代码行数:51,代码来源:conn.c


示例8: xfrm_accept_msg

static int xfrm_accept_msg(const struct sockaddr_nl *who,
			   struct nlmsghdr *n, void *arg)
{
	FILE *fp = (FILE*)arg;

	if (timestamp)
		print_timestamp(fp);

	if (n->nlmsg_type == XFRM_MSG_NEWSA ||
	    n->nlmsg_type == XFRM_MSG_DELSA ||
	    n->nlmsg_type == XFRM_MSG_UPDSA ||
	    n->nlmsg_type == XFRM_MSG_EXPIRE) {
		xfrm_state_print(who, n, arg);
		return 0;
	}
	if (n->nlmsg_type == XFRM_MSG_NEWPOLICY ||
	    n->nlmsg_type == XFRM_MSG_DELPOLICY ||
	    n->nlmsg_type == XFRM_MSG_UPDPOLICY ||
	    n->nlmsg_type == XFRM_MSG_POLEXPIRE) {
		xfrm_policy_print(who, n, arg);
		return 0;
	}

	if (n->nlmsg_type == XFRM_MSG_ACQUIRE) {
		xfrm_acquire_print(who, n, arg);
		return 0;
	}
	if (n->nlmsg_type == XFRM_MSG_FLUSHSA) {
		/* XXX: Todo: show proto in xfrm_usersa_flush */
		fprintf(fp, "Flushed state\n");
		return 0;
	}
	if (n->nlmsg_type == XFRM_MSG_FLUSHPOLICY) {
		fprintf(fp, "Flushed policy\n");
		return 0;
	}
	if (n->nlmsg_type == XFRM_MSG_REPORT) {
		xfrm_report_print(who, n, arg);
		return 0;
	}
	if (n->nlmsg_type == XFRM_MSG_NEWAE) {
		xfrm_ae_print(who, n, arg);
		return 0;
	}
	if (n->nlmsg_type != NLMSG_ERROR && n->nlmsg_type != NLMSG_NOOP &&
	    n->nlmsg_type != NLMSG_DONE) {
		fprintf(fp, "Unknown message: %08d 0x%08x 0x%08x\n",
			n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags);
	}
	return 0;
}
开发者ID:Nymphetaminer,项目名称:dsl-n55u,代码行数:51,代码来源:xfrm_monitor.c


示例9: print_wim_direntry

void
print_wim_direntry (const char *prefix, struct wim_direntry *dir)
{
	printf ("%s.length = %" PRIu64 "\n", prefix, dir->length);
	printf ("%s.attributes = %" PRIu32, prefix, dir->attributes);
	if (dir->attributes) {
		printf (" (");
		print_wim_file_attributes (dir->attributes);
		printf (")");
	}
	printf ("\n");
	printf ("%s.security_id = %" PRIu32 "\n", prefix, dir->security_id);
	printf ("%s.subidr_offset = %" PRIu64 "\n", prefix, dir->subdir_offset);
	printf ("%s.creation_time = %" PRIi64 " (", prefix, dir->creation_time);
	print_timestamp (dir->creation_time);
	printf (")\n");
	printf ("%s.last_access_time = %" PRIi64 " (", prefix, dir->last_access_time);
	print_timestamp (dir->last_access_time);
	printf (")\n");
	printf ("%s.last_write_time = %" PRIi64 " (", prefix, dir->last_write_time);
	print_timestamp (dir->last_write_time);
	printf (")\n");
	printf ("%s.hash = ", prefix);
	print_hex (dir->hash, sizeof (dir->hash));
	printf ("\n");
	printf ("%s.reparse_tag = %" PRIu32 "\n", prefix, dir->reparse_tag);
	printf ("%s.hardlink = %" PRIu64 "\n", prefix, dir->hardlink);
	printf ("%s.streams = %" PRIu16 "\n", prefix, dir->streams);
	printf ("%s.short_name_length = %" PRIu16 "\n", prefix, dir->short_name_length);
	printf ("%s.file_name_length = %" PRIu16 "\n", prefix, dir->file_name_length);
	if (dir->file_name_length > 0) {
		printf ("%s.filename = ", prefix);
		print_utf16 (dir->filename, dir->file_name_length);
		printf ("\n");
	}
}
开发者ID:md-jamal,项目名称:wimdump,代码行数:36,代码来源:wimdump.c


示例10: print_headers

static void print_headers(FILE *fp, char *label, struct rtnl_ctrl_data *ctrl)
{
	if (timestamp)
		print_timestamp(fp);

	if (listen_all_nsid) {
		if (ctrl == NULL || ctrl->nsid < 0)
			fprintf(fp, "[nsid current]");
		else
			fprintf(fp, "[nsid %d]", ctrl->nsid);
	}

	if (prefix_banner)
		fprintf(fp, "%s", label);
}
开发者ID:6WIND,项目名称:iproute2,代码行数:15,代码来源:ipmonitor.c


示例11: log_unban

/* Log an unbanning.
 */
void log_unban(char *logfile, t_ip_addr *ip_address, unsigned long connect_attempts) {
	FILE *fp;
	char str[TIMESTAMP_SIZE + IP_ADDRESS_SIZE];

	if ((logfile == NULL) || (ip_address == NULL)) {
		return;
	} else if ((fp = fopen(logfile, "a")) == NULL) {
		return;
	}

	ip_to_str(str, ip_address, IP_ADDRESS_SIZE);
	strcat(str, "|");
	print_timestamp(str + strlen(str));
	fprintf(fp, "%sUnbanned (%ld connect attempts during ban)"EOL, str, connect_attempts);
	fclose(fp);
}
开发者ID:wdlth,项目名称:hiawatha,代码行数:18,代码来源:log.c


示例12: RMDBGLOG_implementation

void RMDBGLOG_implementation(RMbool active,const RMascii *filename,RMint32 line,const RMascii *text,...)
{  
	if (active && (verbose_stderr != 0)) {
		va_list ap;
		
		snprintf((char *)str,RMDBG_MAX_STRING,"[%s:%ld] ", (char *)filename,line);
		
		va_start(ap, text);
		vsnprintf((char *)(str+strlen(str)), RMDBG_MAX_STRING-strlen(str), text, ap); 
		va_end(ap);
		
		print_timestamp(NORMALMSG);
		fprintf(NORMALMSG,str);
		fflush(NORMALMSG);
	}
}
开发者ID:yixinshark,项目名称:ZyzBq,代码行数:16,代码来源:dbgimplementation.c


示例13: form_command

lcb_error_t form_command(lcb_error_t err, lcb_t instance, const char * const key, const int count) {
	lcb_store_cmd_t cmd;
	const lcb_store_cmd_t* commands[1];
	commands[0] = &cmd;
	memset(&cmd, 0, sizeof(cmd));
	cmd.v.v0.operation = LCB_SET;
	cmd.v.v0.key = "foo";
    if (key) cmd.v.v0.key = key;
	cmd.v.v0.nkey = 3;
	cmd.v.v0.bytes = "bar";
	cmd.v.v0.nbytes = 3;
    print_timestamp();
    for (int i=0; i < count; i++)
        err = lcb_store(instance, NULL, 1, commands);
	return err;
}
开发者ID:TigerZhang,项目名称:libcouchbase,代码行数:16,代码来源:minimal.c


示例14: xfrm_accept_msg

static int xfrm_accept_msg(const struct sockaddr_nl *who,
			   struct nlmsghdr *n, void *arg)
{
	FILE *fp = (FILE*)arg;

	if (timestamp)
		print_timestamp(fp);

	switch (n->nlmsg_type) {
	case XFRM_MSG_NEWSA:
	case XFRM_MSG_DELSA:
	case XFRM_MSG_UPDSA:
	case XFRM_MSG_EXPIRE:
		xfrm_state_print(who, n, arg);
		return 0;
	case XFRM_MSG_NEWPOLICY:
	case XFRM_MSG_DELPOLICY:
	case XFRM_MSG_UPDPOLICY:
	case XFRM_MSG_POLEXPIRE:
		xfrm_policy_print(who, n, arg);
		return 0;
	case XFRM_MSG_ACQUIRE:
		xfrm_acquire_print(who, n, arg);
		return 0;
	case XFRM_MSG_FLUSHSA:
		xfrm_state_flush_print(who, n, arg);
		return 0;
	case XFRM_MSG_FLUSHPOLICY:
		xfrm_policy_flush_print(who, n, arg);
		return 0;
	case XFRM_MSG_REPORT:
		xfrm_report_print(who, n, arg);
		return 0;
	case XFRM_MSG_NEWAE:
		xfrm_ae_print(who, n, arg);
		return 0;
	default:
		break;
	}

	if (n->nlmsg_type != NLMSG_ERROR && n->nlmsg_type != NLMSG_NOOP &&
	    n->nlmsg_type != NLMSG_DONE) {
		fprintf(fp, "Unknown message: %08d 0x%08x 0x%08x\n",
			n->nlmsg_len, n->nlmsg_type, n->nlmsg_flags);
	}
	return 0;
}
开发者ID:247a,项目名称:lenovo_b6000-8000_kernel_source,代码行数:47,代码来源:xfrm_monitor.c


示例15: log_cgi_error

/* Log a CGI error.
 */
void log_cgi_error(t_session *session, char *mesg) {
	FILE *fp;
	char *c, str[TIMESTAMP_SIZE + IP_ADDRESS_SIZE];
	int len = 0;

	if ((session->host->error_logfile == NULL) || (mesg == NULL)) {
		return;
	}

	c = mesg;
	while (*c != '\0') {
		if (*c == '\n') {
			if (*(c + 1) == '\0') {
				*c = '\0';
			} else {
				*c = '|';
			}
		} else {
			len++;
		}
		c++;
	}

	if (len == 0) {
		return;
	}

	if ((fp = fopen(session->host->error_logfile, "a")) == NULL) {
		return;
	}

	if (session->config->anonymize_ip) {
		anonymized_ip_to_str(&(session->ip_address), str, IP_ADDRESS_SIZE);
	} else {
		ip_to_str(&(session->ip_address), str, IP_ADDRESS_SIZE);
	}

	strcat(str, "|");
	print_timestamp(str + strlen(str));
	if (session->file_on_disk == NULL) {
		fprintf(fp, "%s-|%s"EOL, str, secure_string(mesg));
	} else {
		fprintf(fp, "%s%s|%s"EOL, str, session->file_on_disk, secure_string(mesg));
	}
	fclose(fp);
}
开发者ID:VCTLabs,项目名称:hiawatha,代码行数:48,代码来源:log.c


示例16: recv_timestamp

int
recv_timestamp (int code, void *closure,
		struct sockaddr_in *dest, struct sockaddr_in *from,
		struct ip *ip, icmphdr_t * icmp, int datalen)
{
  switch (code)
    {
    case PEV_RESPONSE:
    case PEV_DUPLICATE:
      print_timestamp (code == PEV_DUPLICATE,
		       closure, dest, from, ip, icmp, datalen);
      break;
    case PEV_NOECHO:;
      print_icmp_header (from, ip, icmp, datalen);
    }
  return 0;
}
开发者ID:Distrotech,项目名称:inetutils,代码行数:17,代码来源:ping_timestamp.c


示例17: get_callback

static void get_callback(lcb_t instance, const void *cookie, lcb_error_t error,
                         const lcb_get_resp_t *item)
{
    if (error == LCB_SUCCESS) {
        print_timestamp();
        fprintf(stderr, "GOT \"");
        fwrite(item->v.v0.key, sizeof(char), item->v.v0.nkey, stderr);
        fprintf(stderr, "\" CAS: %"PRIu64" FLAGS:0x%x SIZE:%lu\n",
                item->v.v0.cas, item->v.v0.flags, (unsigned long)item->v.v0.nbytes);
        fwrite(item->v.v0.bytes, sizeof(char), item->v.v0.nbytes, stderr);
        fprintf(stderr, "\n");
    } else {
        fprintf(stderr, "GET ERROR: %s (0x%x)\n",
                lcb_strerror(instance, error), error);
    }
    (void)cookie;
}
开发者ID:TigerZhang,项目名称:libcouchbase,代码行数:17,代码来源:minimal.c


示例18: log_file_error

/* Log an error for a specific file
 */
void log_file_error(t_session *session, char *file, char *mesg, ...) {
	FILE *fp;
	va_list args;
	char str[TIMESTAMP_SIZE + IP_ADDRESS_SIZE + 2];

	if (mesg == NULL) {
		return;
	}

	if (session->host == NULL) {
		if (session->config->first_host->error_logfile == NULL) {
			return;
		}
		fp = fopen(session->config->first_host->error_logfile, "a");
	} else {
		if (session->host->error_logfile == NULL) {
			return;
		}
		fp = fopen(session->host->error_logfile, "a");
	}
	if (fp == NULL) {
		return;
	}

	va_start(args, mesg);

	if (session->config->anonymize_ip) {
		anonymized_ip_to_str(&(session->ip_address), str, IP_ADDRESS_SIZE);
	} else {
		ip_to_str(&(session->ip_address), str, IP_ADDRESS_SIZE);
	}

	strcat(str, "|");
	print_timestamp(str + strlen(str));
	if (file == NULL) {
		fprintf(fp, "%s", str);
	} else {
		fprintf(fp, "%s%s|", str, file);
	}
	vfprintf(fp, mesg, args);
	fprintf(fp, EOL);
	fclose(fp);

	va_end(args);
}
开发者ID:VCTLabs,项目名称:hiawatha,代码行数:47,代码来源:log.c


示例19: dsrv_log

  /* TODO: output addresses manually */
#   warning "inet_ntop() not available, network addresses will not be included in debug output"
# endif /* WITH_CONTIKI */
  return 0;
#endif
}

#endif /* NDEBUG */

#ifndef WITH_CONTIKI
void 
dsrv_log(log_t level, char *format, ...) {
  static char timebuf[32];
  va_list ap;
  FILE *log_fd;

  if (maxlog < (int)level)
    return;

  log_fd = level <= DTLS_LOG_CRIT ? stderr : stdout;

  if (print_timestamp(timebuf,sizeof(timebuf), time(NULL)))
    fprintf(log_fd, "%s ", timebuf);

  if (level <= DTLS_LOG_DEBUG) 
    fprintf(log_fd, "%s ", loglevels[level]);

  va_start(ap, format);
  vfprintf(log_fd, format, ap);
  va_end(ap);
  fflush(log_fd);
}
#elif defined (HAVE_VPRINTF) /* WITH_CONTIKI */
void 
dsrv_log(log_t level, char *format, ...) {
  static char timebuf[32];
  va_list ap;

  if (maxlog < level)
    return;

  if (print_timestamp(timebuf,sizeof(timebuf), clock_time()))
    PRINTF("%s ", timebuf);

  if (level <= DTLS_LOG_DEBUG) 
    PRINTF("%s ", loglevels[level]);

  va_start(ap, format);
  vprintf(format, ap);
  va_end(ap);
}
开发者ID:lsuciu70,项目名称:arduino,代码行数:51,代码来源:dtls_debug.c


示例20: form_command_get

lcb_error_t form_command_get(int count, lcb_error_t err, lcb_t instance,
		char* key) {
	lcb_get_cmd_t cmd;
	const lcb_get_cmd_t* commands[1];
	commands[0] = &cmd;
	memset(&cmd, 0, sizeof(cmd));
	cmd.v.v0.key = "foo";
	if (key)
		cmd.v.v0.key = key;

	cmd.v.v0.nkey = 3;
	print_timestamp();
	for (int i = 0; i < count; i++) {
		err = lcb_get(instance, NULL, 1, commands);

	}
	return err;
}
开发者ID:TigerZhang,项目名称:libcouchbase,代码行数:18,代码来源:minimal.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ print_trace函数代码示例发布时间:2022-05-30
下一篇:
C++ print_time函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap