本文整理汇总了C++中zlog_info函数的典型用法代码示例。如果您正苦于以下问题:C++ zlog_info函数的具体用法?C++ zlog_info怎么用?C++ zlog_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zlog_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: http_engine_setup_worker_directories
char *
http_engine_setup_worker_directories()
{
static int worker_id = 0;
char dir_name[MAX_NAME_LENGTH] = {0};
char worker_id_str[10] = {0};
struct stat st = {0};
int error = 0;
http_config_t *global_config = http_config_get();
sprintf(worker_id_str, "%d", ++worker_id);
/* Setup directory name */
strncpy(dir_name, global_config->output_directory,
strlen(global_config->output_directory));
strcat(dir_name, "/worker_");
strncat(dir_name, worker_id_str, strlen(worker_id_str));
if (stat(dir_name, &st) == -1) {
zlog_info(log_get_cat(), "Creating directory: %s", dir_name);
error = mkdir(dir_name, 0777);
}
if (error) {
return NULL;
}
return(strdup(dir_name));
}
示例2: twoway_received
int
twoway_received (struct thread *thread)
{
struct ospf6_neighbor *on;
on = (struct ospf6_neighbor *) THREAD_ARG (thread);
assert (on);
if (on->state > OSPF6_NEIGHBOR_INIT)
return 0;
if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
zlog_info ("Neighbor Event %s: *2Way-Received*", on->name);
thread_add_event (master, neighbor_change, on->ospf6_if, 0);
if (! need_adjacency (on))
{
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_TWOWAY, on);
return 0;
}
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on);
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT);
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT);
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT);
THREAD_OFF (on->thread_send_dbdesc);
on->thread_send_dbdesc =
thread_add_event (master, ospf6_dbdesc_send, on, 0);
return 0;
}
示例3: bad_lsreq
int
bad_lsreq (struct thread *thread)
{
struct ospf6_neighbor *on;
struct ospf6_lsa *lsa;
on = (struct ospf6_neighbor *) THREAD_ARG (thread);
assert (on);
if (on->state < OSPF6_NEIGHBOR_EXCHANGE)
return 0;
if (IS_OSPF6_DEBUG_NEIGHBOR (EVENT))
zlog_info ("Neighbor Event %s: *BadLSReq*", on->name);
ospf6_neighbor_state_change (OSPF6_NEIGHBOR_EXSTART, on);
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MSBIT);
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_MBIT);
SET_FLAG (on->dbdesc_bits, OSPF6_DBDESC_IBIT);
ospf6_lsdb_remove_all (on->summary_list);
ospf6_lsdb_remove_all (on->request_list);
for (lsa = ospf6_lsdb_head (on->retrans_list); lsa;
lsa = ospf6_lsdb_next (lsa))
{
ospf6_decrement_retrans_count (lsa);
ospf6_lsdb_remove (lsa, on->retrans_list);
}
THREAD_OFF (on->thread_send_dbdesc);
on->thread_send_dbdesc =
thread_add_event (master, ospf6_dbdesc_send, on, 0);
return 0;
}
示例4: DrawBox
void DrawBox(WINDOW* win, int height, int width, int starty, int startx, bool isFirst, bool isLast)
{
mvwhline(win, starty, startx + 1, ACS_HLINE, width );
mvwhline(win, starty + height - 1, startx + 1, ACS_HLINE, width );
mvwvline(win, starty + 1, startx, ACS_VLINE, height - 2 );
//mvwvline(win, starty + 1 , width + startx, ACS_VLINE, height - 2 );
zlog_info(c, "Drawing box (h=%3d, w=%3d, starty=%3d, startx=%3d, f=%d, l=%d",
height,
width,
starty,
startx,
isFirst,
isLast);
wmove(win, starty + 1, startx + 2); wprintw(win, "%d,%d,%d", startx, starty, (starty % 3));
if (isFirst) {
wmove(win, starty, startx); waddch(win, ACS_ULCORNER);
wmove(win, starty + height - 1, startx); waddch(win, ACS_LLCORNER);
}
if (!isLast) {
wmove(win, starty, startx + width); waddch(win, ACS_TTEE);
wmove(win, starty + height - 1, startx + width); waddch(win, ACS_BTEE);
}else{
wmove(win, starty, startx + width); waddch(win, ACS_URCORNER);
wmove(win, starty + height - 1, startx + width); waddch(win, ACS_LRCORNER);
mvwvline(win, starty + 1, width + startx, ACS_VLINE, height - 2 );
}
}
示例5: ripng_interface_delete
int
ripng_interface_delete (int command, struct zclient *zclient,
zebra_size_t length)
{
struct interface *ifp;
struct stream *s;
s = zclient->ibuf;
/* zebra_interface_state_read() updates interface structure in iflist */
ifp = zebra_interface_state_read(s);
if (ifp == NULL)
return 0;
if (if_is_up (ifp)) {
ripng_if_down(ifp);
}
zlog_info("interface delete %s index %d flags %#llx metric %d mtu %d",
ifp->name, ifp->ifindex, (unsigned long long) ifp->flags,
ifp->metric, ifp->mtu6);
/* To support pseudo interface do not free interface structure. */
/* if_delete(ifp); */
ifp->ifindex = IFINDEX_INTERNAL;
return 0;
}
示例6: pim_zebra_if_state_up
static int pim_zebra_if_state_up(int command, struct zclient *zclient,
zebra_size_t length)
{
struct interface *ifp;
/*
zebra api notifies interface up/down events by using the same call
zebra_interface_state_read below, see comments in lib/zclient.c
*/
ifp = zebra_interface_state_read(zclient->ibuf);
if (!ifp)
return 0;
zlog_info("INTERFACE UP: %s ifindex=%d", ifp->name, ifp->ifindex);
if (PIM_DEBUG_ZEBRA) {
zlog_debug("%s: %s index %d flags %ld metric %d mtu %d operative %d",
__PRETTY_FUNCTION__,
ifp->name, ifp->ifindex, (long)ifp->flags, ifp->metric,
ifp->mtu, if_is_operative(ifp));
}
if (if_is_operative(ifp)) {
/*
pim_if_addr_add_all() suffices for bringing up both IGMP and PIM
*/
pim_if_addr_add_all(ifp);
}
return 0;
}
示例7: ospf_nbr_delete
/* Delete specified OSPF neighbor from interface. */
void ospf_nbr_delete(struct ospf_neighbor *nbr)
{
struct ospf_interface *oi;
struct route_node *rn;
struct prefix p;
oi = nbr->oi;
/* get appropriate prefix 'key' */
ospf_nbr_key(oi, nbr, &p);
rn = route_node_lookup(oi->nbrs, &p);
if (rn) {
/* If lookup for a NBR succeeds, the leaf route_node could
* only exist because there is (or was) a nbr there.
* If the nbr was deleted, the leaf route_node should have
* lost its last refcount too, and be deleted.
* Therefore a looked-up leaf route_node in nbrs table
* should never have NULL info.
*/
assert(rn->info);
if (rn->info) {
rn->info = NULL;
route_unlock_node(rn);
} else
zlog_info("Can't find neighbor %s in the interface %s",
inet_ntoa(nbr->src), IF_NAME(oi));
route_unlock_node(rn);
}
/* Free ospf_neighbor structure. */
ospf_nbr_free(nbr);
}
示例8: ospf6_damp_debug_thread
int
ospf6_damp_debug_thread (struct thread *thread)
{
int i;
struct ospf6_damp_info *di;
char buf[256];
time_t t_now;
struct timeval now;
for (i = 0; i < dc->reuse_list_size; i++)
{
for (di = dc->reuse_list_array[i]; di; di = di->next)
{
t_now = time (NULL);
gettimeofday (&now, NULL);
prefix2str (&di->name, buf, sizeof (buf));
zlog_info ("DAMP: %lu.%06lu %c %-32s penalty %7u",
now.tv_sec, now.tv_usec,
(di->damping == ON ? 'D' : 'A'), buf,
(u_int) (di->penalty *
ospf6_damp_decay (t_now - di->t_updated)));
}
}
thread_add_timer (master, ospf6_damp_debug_thread, NULL, 1);
return 0;
}
示例9: ospf6_damp_create
static struct ospf6_damp_info *
ospf6_damp_create (u_short type, struct prefix *name)
{
struct route_node *node;
struct ospf6_damp_info *di;
char namebuf[64];
di = ospf6_damp_lookup (type, name);
if (di)
return di;
if (IS_OSPF6_DEBUG_DAMP)
{
prefix2str (name, namebuf, sizeof (namebuf));
zlog_info ("DAMP: create: type: %d, name: %s", type, namebuf);
}
di = (struct ospf6_damp_info *)
malloc (sizeof (struct ospf6_damp_info));
memset (di, 0, sizeof (struct ospf6_damp_info));
di->type = type;
prefix_copy (&di->name, name);
node = route_node_get (damp_info_table[type], name);
node->info = di;
return di;
}
示例10: ospf6_damp_stop
/* When we quit damping for a target, we should execute proper event
which have been postponed during damping */
static void
ospf6_damp_stop (struct ospf6_damp_info *di)
{
time_t t_now;
char namebuf[64];
struct timeval now;
if (IS_OSPF6_DEBUG_DAMP)
{
t_now = time (NULL);
prefix2str (&di->name, namebuf, sizeof (namebuf));
gettimeofday (&now, NULL);
zlog_info ("DAMP: %lu.%06lu stop damping: %ld: type: %d, name: %s",
now.tv_sec, now.tv_usec,
t_now, di->type, namebuf);
}
/* set flag indicates that we're damping this target */
di->damping = OFF;
/* if the target's current status differ from that it should be,
execute the proper event to repair his status */
if (di->target_status != di->event_type)
{
(*(di->event)) (di->target);
di->target_status = di->event_type;
di->event = NULL;
di->event_type = event_none;
}
}
示例11: bfd_ioctl_state_change
static int
bfd_ioctl_state_change (struct bfd_nl_peerinfo *peerinfo)
{
struct bfd_peer peer;
struct zserv *client;
struct listnode *node;
if (IS_ZEBRA_DEBUG_KERNEL)
zlog_info ("rcvd peerinfo %s: state=%d, ifindex=%d",
sockunion_log ((union sockunion *) &peerinfo->dst),
peerinfo->state, peerinfo->ifindex);
memcpy (&peer.su, &peerinfo->dst.sa, sizeof (union sockunion));
peer.ifindex = peerinfo->ifindex;
if (peerinfo->state == BSM_Up)
{
for (node = listhead (client_list); node; nextnode (node))
if ((client = getdata (node)) != NULL)
zsend_bfd_peer_up (client, &peer);
}
else if (peerinfo->state == BSM_Down)
{
for (node = listhead (client_list); node; nextnode (node))
if ((client = getdata (node)) != NULL)
zsend_bfd_peer_down (client, &peer);
}
else
{
}
return 0;
}
示例12: main
int main(int argc, char** argv)
{
int rc;
zlog_category_t *zc;
rc = zlog_init("test_level.conf");
if (rc) {
printf("init failed\n");
return -1;
}
zc = zlog_get_category("my_cat");
if (!zc) {
printf("get cat fail\n");
zlog_fini();
return -2;
}
zlog_trace(zc, "hello, zlog - trace");
zlog_debug(zc, "hello, zlog - debug");
zlog_info(zc, "hello, zlog - info");
zlog_fini();
return 0;
}
示例13: main
int main(int argc, char** argv)
{
int rc = 0;
zlog_category_t *zc = NULL;
// 初始化库, 给出配置文件路径
rc = zlog_init("test_hello.conf");
if (rc) {
printf("init failed\n");
return -1;
}
// 获取分类名, 表示要打印哪些日志
zc = zlog_get_category("my_cat");
if (!zc) {
printf("get cat fail\n");
zlog_fini();
return -2;
}
zlog_info(zc, "hello, zlog");
zlog_fini();
return 0;
}
示例14: zlog_test
int zlog_test()
{
int rc;
zlog_category_t *c;
rc = zlog_init("d:\\tmp\\zlog.conf");
if (rc) {
printf("init failed\n");
return -1;
}
c = zlog_get_category("my_cat");
if (!c) {
printf("get cat fail\n");
zlog_fini();
return -2;
}
zlog_info(c, "hello, zlog");
zlog_debug(c, "hello, zlog");
zlog_error(c, "hello, zlog");
zlog_fini();
printf("exit.\n");
return 0;
}
示例15: smux_parse_get
void
smux_parse_get (char *ptr, size_t len, int exact)
{
long reqid;
oid oid[MAX_OID_LEN];
size_t oid_len;
u_char val_type;
void *val;
size_t val_len;
int ret;
if (debug_smux)
zlog_info ("SMUX GET message parse: len %d", len);
/* Parse GET message header. */
ptr = smux_parse_get_header (ptr, &len, &reqid);
/* Parse GET message object ID. We needn't the value come */
ptr = smux_var (ptr, len, oid, &oid_len, NULL, NULL, NULL);
/* Traditional getstatptr. */
if (exact)
ret = smux_get (oid, &oid_len, exact, &val_type, &val, &val_len);
else
ret = smux_getnext (oid, &oid_len, exact, &val_type, &val, &val_len);
/* Return result. */
if (ret == 0)
smux_getresp_send (oid, oid_len, reqid, 0, 0, val_type, val, val_len);
else
smux_getresp_send (oid, oid_len, reqid, ret, 3, ASN_NULL, NULL, 0);
}