#include "os_base.h"
#include <signal.h>
#include <syslog.h>
#define MY_TAG_ONE (1)
#define MY_TAG_TWO (1 << 1)
#define MY_TAG_THREE (1 << 2)
static uint8_t _log_priority = LOG_WARNING;
static void
func_one(void)
{
FILE *fd;
qb_logt(LOG_DEBUG, MY_TAG_TWO,
"arf arf?");
qb_logt(LOG_CRIT, MY_TAG_THREE,
"arrrg!");
qb_logt(134, MY_TAG_THREE,
"big priority");
qb_logt(LOG_ERR, MY_TAG_THREE,
"oops, I did it again");
qb_log(LOG_INFO,
"are you aware ...");
fd = fopen("/nothing.txt", "r+");
if (fd == NULL) {
qb_perror(LOG_ERR,
"can't open(\"/nothing.txt\")");
} else {
fclose(fd);
}
}
static void
func_two(void)
{
qb_logt(LOG_CRIT, MY_TAG_ONE,
"arrrg!");
qb_log(LOG_ERR,
"oops, I did it again");
qb_logt(LOG_INFO, MY_TAG_THREE,
"are you aware ...");
}
static void
show_usage(const char *name)
{
printf("usage: \n");
printf("%s <options>\n", name);
printf("\n");
printf(" options:\n");
printf("\n");
printf(" -v verbose\n");
printf(" -t threaded logging\n");
printf(" -o log to stdout\n");
printf(" -e log to stderr\n");
printf(" -b log to blackbox\n");
printf(" -f <filename> log to a file\n");
printf(" -h show this help text\n");
printf("\n");
}
static void
sigsegv_handler(int sig)
{
(void)signal(SIGSEGV, SIG_DFL);
if (do_blackbox) {
}
raise(SIGSEGV);
}
static const char *
my_tags_stringify(uint32_t
tags)
{
return "libqb";
return "ONE";
return "TWO";
return "THREE";
} else {
return "MAIN";
}
}
static void
trace_logger(int32_t t,
{
output_buffer[0] = '\0';
fprintf(stderr, "%s\n", output_buffer);
}
static void
{
} else {
}
}
int32_t
main(int32_t argc, char *argv[])
{
const char *options = "vhteobdf:";
int32_t opt;
int32_t tracer;
char *logfile = NULL;
int32_t log_fd = -1;
while ((opt = getopt(argc, argv, options)) != -1) {
switch (opt) {
case 'd':
break;
case 't':
break;
case 'e':
break;
case 'o':
break;
case 'b':
break;
case 'f':
logfile = optarg;
break;
case 'v':
_log_priority++;
break;
case 'h':
default:
show_usage(argv[0]);
exit(0);
break;
}
}
if (do_dump_blackbox) {
exit(0);
}
signal(SIGSEGV, sigsegv_handler);
if (do_stderr) {
}
if (do_stdout) {
LOG_ALERT,
QB_MIN(LOG_DEBUG, _log_priority));
}
if (do_blackbox) {
}
if (logfile) {
}
if (do_threaded) {
}
qb_log(LOG_INFO,
"this is an info");
qb_log(LOG_NOTICE,
"hello - notice?");
{
char * str = NULL;
"%s-%d-%s-%u",
NULL, 952, str, 56);
}
func_one();
func_two();
if (!do_threaded) {
qb_log(LOG_WARNING,
"no syslog");
}
if (do_blackbox) {
logfile = NULL;
logfile[5] = 'a';
} else {
}
return 0;
}