POSIX: Improved logging

The warnx and warn calls map to PX4_WARN.
Calls to errx or err genrtate a compile error.

The px4_log.h file implements a new log format:

For DEBUG and INFO:
<level> <msg>

For ERROR and WARN:
<level> <msg> (file filepath line linenum)

The verbosity can be changed by setting the macro to use
either linux_log or linux_log_verbose in px4_log.h

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois
2015-05-19 09:19:24 -07:00
parent 791d780bb8
commit ffdc9d629c
17 changed files with 161 additions and 120 deletions
+2 -2
View File
@@ -335,7 +335,7 @@ void Simulator::updateSamples()
int serial_fd = open(PIXHAWK_DEVICE, O_RDWR);
if (serial_fd < 0) {
PX4_WARN("failed to open %s\n", PIXHAWK_DEVICE);
PX4_WARN("failed to open %s", PIXHAWK_DEVICE);
}
// tell the device to stream some messages
@@ -343,7 +343,7 @@ void Simulator::updateSamples()
int w = ::write(serial_fd, command, sizeof(command));
if (w <= 0) {
PX4_WARN("failed to send streaming command to %s\n", PIXHAWK_DEVICE);
PX4_WARN("failed to send streaming command to %s", PIXHAWK_DEVICE);
}
char serial_buf[1024];