Log more debug data.
This commit is contained in:
2
adsbus/.gitignore
vendored
2
adsbus/.gitignore
vendored
@@ -35,4 +35,4 @@
|
||||
adsbus
|
||||
|
||||
# Generated
|
||||
version.h
|
||||
build.h
|
||||
|
||||
@@ -19,14 +19,16 @@ OBJ_PROTO = adsb.pb-c.o
|
||||
all: adsbus
|
||||
|
||||
clean:
|
||||
rm -rf *.o adsbus testout findings version.h
|
||||
rm -rf *.o adsbus testout findings build.h
|
||||
|
||||
%.o: %.c *.h
|
||||
%.o: %.c *.h build.h
|
||||
$(COMP) -c $(CFLAGS) $< -o $@
|
||||
|
||||
version.h:
|
||||
echo "#define GIT_LAST_CHANGE \"$$(git log --format=%H -n 1)\"" > version.h
|
||||
echo "#define GIT_LOCAL_CLEAN $$(git diff --exit-code > /dev/null && echo true || echo false)" >> version.h
|
||||
build.h:
|
||||
echo "#define GIT_LAST_CHANGE \"$$(git log --format=%H -n 1)\"" > $@
|
||||
echo "#define GIT_LOCAL_CLEAN $$(git diff --exit-code > /dev/null && echo true || echo false)" >> $@
|
||||
echo "#define HOSTNAME \"$$(hostname --fqdn)\"" >> $@
|
||||
echo "#define USERNAME \"$$(whoami)\"" >> $@
|
||||
|
||||
adsb.pb-c.c: ../proto/adsb.proto
|
||||
protoc-c --c_out=./ --proto_path=$(dir $<) $<
|
||||
|
||||
@@ -93,7 +93,7 @@ bool log_reopen(const char *path) {
|
||||
void log_write(char type, const char *loc, const uint8_t *id, const char *fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
assert(fprintf(log_stream, "%c [%20s] %s: ", type, loc, id) > 0);
|
||||
assert(fprintf(log_stream, "%c [%18s] %s: ", type, loc, id) > 0);
|
||||
assert(vfprintf(log_stream, fmt, ap) > 0);
|
||||
assert(fprintf(log_stream, "\n") == 1);
|
||||
va_end(ap);
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
#include <jansson.h>
|
||||
#include <protobuf-c/protobuf-c.h>
|
||||
|
||||
#include "build.h"
|
||||
#include "log.h"
|
||||
#include "uuid.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "server.h"
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wdate-time"
|
||||
|
||||
uint8_t server_id[UUID_LEN];
|
||||
char server_version[] = "https://github.com/flamingcowtv/adsb-tools#1";
|
||||
|
||||
@@ -10,5 +16,14 @@ static char log_module = 'X';
|
||||
|
||||
void server_init() {
|
||||
uuid_gen(server_id);
|
||||
LOG(server_id, "Server start");
|
||||
LOG(server_id, "Server start:");
|
||||
LOG(server_id, "\tgit_last_change: %s", GIT_LAST_CHANGE);
|
||||
LOG(server_id, "\tgit_local_clean: %s", GIT_LOCAL_CLEAN ? "true" : "false");
|
||||
LOG(server_id, "\tclang_version: %s", __clang_version__);
|
||||
LOG(server_id, "\tglibc_version: %d.%d", __GLIBC__, __GLIBC_MINOR__);
|
||||
LOG(server_id, "\tjansson_version: %s", JANSSON_VERSION);
|
||||
LOG(server_id, "\tprotobuf-c_version: %s", PROTOBUF_C_VERSION);
|
||||
LOG(server_id, "\tbuild_datetime: %s", __DATE__ " " __TIME__);
|
||||
LOG(server_id, "\tbuild_username: %s", USERNAME);
|
||||
LOG(server_id, "\tbuild_hostname: %s", HOSTNAME);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user