本文整理汇总了C++中Trace::SetErrorLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ Trace::SetErrorLevel方法的具体用法?C++ Trace::SetErrorLevel怎么用?C++ Trace::SetErrorLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trace
的用法示例。
在下文中一共展示了Trace::SetErrorLevel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/** get the current tracer.
* Call with 'true' when you want to change the tracer
* and with 'false' when you want to use it.
*
* If the current tracer has been used, it's not modified; instead, it is
* passed to Layer3 (which will deallocate it when it ends) and copied to
* a new instance.
*/
Trace *tracer(bool modify = false)
{
if (modify && trace_used)
{
Trace *tr = new Trace(*t);
l3()->registerTracer(t);
t = tr;
trace_used = false;
}
else if (! t)
{
t = new Trace();
trace_used = !modify;
t->SetErrorLevel (LEVEL_WARNING); // default
}
else if (!modify)
trace_used = true;
return t;
}
示例2: 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);
//.........这里部分代码省略.........