本文整理汇总了C++中Trace::SetTraceLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ Trace::SetTraceLevel方法的具体用法?C++ Trace::SetTraceLevel怎么用?C++ Trace::SetTraceLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trace
的用法示例。
在下文中一共展示了Trace::SetTraceLevel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: memset
int
main (int ac, char *ag[])
{
int addr;
int len;
int index;
CArray result;
LowLevelDriver *iface = 0;
memset (&arg, 0, sizeof (arg));
argp_parse (&argp, ac, ag, 0, &index, &arg);
if (index > ac - 3)
die ("more parameter expected");
if (index < ac - 3)
die ("unexpected parameter");
signal (SIGPIPE, SIG_IGN);
pth_init ();
Trace t;
t.SetTraceLevel (arg.tracelevel);
iface = Create (ag[index], &t);
if (!iface)
die ("initialisation failed");
if (!iface->init ())
die ("initialisation failed");
addr = readHex (ag[index + 1]);
len = atoi (ag[index + 2]);
int res = readEMIMem (iface, addr, len, result);
if (!res)
{
printf ("Read failed");
}
else
{
for (int i = 0; i < result (); i++)
printf ("%02x ", result[i]);
printf ("\n");
}
delete iface;
pth_exit (0);
return 0;
}
示例2: die
int
main (int ac, char *ag[])
{
int tracelevel;
int sport;
int dport;
char *a, *b, *c;
if (ac != 2 && ac != 3)
die ("Usage: %s ip[:dst-port[:src-port]] [tracelevel]", ag[0]);
struct sockaddr_in saddr;
struct sockaddr_in caddr;
EIBNetIPSocket *sock;
ev_timer timeout;
ev_timer_init(&timeout, &end_me, 10.,0.);
ev_timer_start(EV_DEFAULT_ &timeout);
tracelevel = 0;
if (ac == 3)
tracelevel = atoi (ag[2]);
a = strdup (ag[1]);
if (!a)
die ("out of memory");
for (b = a; *b; b++)
if (*b == ':')
break;
sport = 3672;
if (*b == ':')
{
*b = 0;
for (c = b + 1; *c; c++)
if (*c == ':')
break;
if (*c == ':')
{
*c = 0;
sport = atoi (c + 1);
}
dport = atoi (b + 1);
}
else
dport = 3671;
std::string edesc = "eibnetdescribe";
Trace t = Trace(edesc, "main");
t.SetTraceLevel (tracelevel);
printf ("Asking %s at port %d from port %d\n", a, dport, sport);
if (!GetHostIP (NULL, &caddr, a))
die ("Host not found");
caddr.sin_port = htons (dport);
if (!GetSourceAddress (TracePtr(new Trace(t,a)), &caddr, &saddr))
die ("No route found");
saddr.sin_port = htons (sport);
sock = new EIBNetIPSocket (saddr, 0, TracePtr(new Trace(t,a)));
sock->sendaddr = caddr;
sock->recvaddr = caddr;
if (!sock->init ())
die ("IP initialisation failed");
EIBnet_DescriptionRequest req;
EIBNetIPPacket *p1;
req.caddr = saddr;
sock->on_read.set<recv_me>();
sock->Send (req.ToPacket ());
ev_run (EV_DEFAULT_ 0);
return 0;
}
示例3: memset
int
main (int ac, char *ag[])
{
int index;
Queue < Server * >server;
Server *s;
Layer2Interface *l2;
Layer3 *l3;
#ifdef HAVE_EIBNETIPSERVER
EIBnetServer *serv = 0;
#endif
memset (&arg, 0, sizeof (arg));
arg.addr = 0x0001;
arg.errorlevel = LEVEL_WARNING;
argp_parse (&argp, ac, ag, 0, &index, &arg);
if (index > ac - 1)
die ("url expected");
if (index < ac - 1)
die ("unexpected parameter");
if (arg.port == 0 && arg.name == 0 && arg.serverip == 0)
die ("No listen-address given");
signal (SIGPIPE, SIG_IGN);
pth_init ();
Trace t;
t.SetTraceLevel (arg.tracelevel);
t.SetErrorLevel (arg.errorlevel);
/*
if (getuid () == 0)
ERRORPRINTF (&t, 0x37000001, 0, "EIBD should not run as root");
*/
if(arg.eibnetname)
{
if(arg.eibnetname[0] == '=')
arg.eibnetname++;
if(strlen(arg.eibnetname) >= 30)
die("EIBnetServer/IP name can't be longer then 30 char");
}
if (arg.daemon)
{
int fd = open (arg.daemon, O_WRONLY | O_APPEND | O_CREAT, FILE_MODE);
if (fd == -1)
die ("Can not open file %s", arg.daemon);
int i = fork ();
if (i < 0)
die ("fork failed");
if (i > 0)
exit (0);
close (1);
close (2);
close (0);
dup2 (fd, 1);
dup2 (fd, 2);
close (fd);
setsid ();
}
FILE *pidf;
if (arg.pidfile)
if ((pidf = fopen (arg.pidfile, "w")) != NULL)
{
fprintf (pidf, "%d", getpid ());
fclose (pidf);
}
l2 = Create (ag[index], arg.backendflags, &t);
if (!l2 || !l2->init ())
die ("initialisation of the backend failed");
l3 = new Layer3 (l2, &t);
if (arg.port)
{
s = new InetServer (l3, &t, arg.port);
if (!s->init ())
die ("initialisation of the knxd inet protocol failed");
server.put (s);
}
if (arg.name)
{
s = new LocalServer (l3, &t, arg.name);
if (!s->init ())
die ("initialisation of the knxd unix protocol failed");
server.put (s);
}
#ifdef HAVE_EIBNETIPSERVER
serv = startServer (l3, &t, arg.eibnetname);
#endif
#ifdef HAVE_GROUPCACHE
if (!CreateGroupCache (l3, &t, arg.groupcache))
die ("initialisation of the group cache failed");
#endif
signal (SIGINT, SIG_IGN);
//.........这里部分代码省略.........