forked from freebsd/freebsd-src
-
Notifications
You must be signed in to change notification settings - Fork 0
pjdlog(3)
Mateusz Piotrowski edited this page Aug 4, 2016
·
1 revision
-
Copy
/contrib/openbsm/bin/auditdistd/pjdlog.*
to your project. -
Add
pjdlog.c
to your make file (probably something likeSRCS+= pjdlog.c
should work). -
You'll probably be facing
.../pjdlog.h:40:10: fatal error: 'compat/compat.h' file not found #include <compat/compat.h> ^ 1 error generated. *** Error code 1 Stop.
when you try to run make
.
If so then add something like
OPENBSMDIR=${.CURDIR}/../../contrib/openbsm
CFLAGS+=-I${OPENBSMDIR} -I${OPENBSMDIR}/sys
to you Makefile (adjust the paths to fit your project).
- Add
#include "pjdlog.h"
to your source and you're ready to go.
The lower the debug log level is the more it is important.
pjdlog_debug_set(1);
pjdlog_debug(1, "a");
pjdlog_debug(2, "b");
prints
a
pjdlog_debug_set(2);
pjdlog_debug(1, "a");
pjdlog_debug(2, "b");
prints
a
b
#include "pjdlog.h"
int main() {
// Initialize pjdlog to log into stderr.
pjdlog_init(PJDLOG_MODE_STD);
// Enable debug logging. There will be only one level of debug messages.
pjdlog_debug_set(1);
// Log.
pjdlog_debug(1, "aaa!!!111");
// Close pjdlog.
pjdlog_fini();
}