mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
fixed print utility and some debug messages
git-svn-id: https://zerberus.eonerc.rwth-aachen.de:8443/svn/s2ss/trunk@12 8ec27952-4edc-4aab-86aa-e87bb2611832
This commit is contained in:
parent
cc144cdc8a
commit
92ea1a7802
3 changed files with 3 additions and 4 deletions
|
@ -13,10 +13,10 @@
|
|||
|
||||
void msg_fprint(FILE *f, struct msg *msg)
|
||||
{
|
||||
fprintf(f, "p: dev_id = %u, msg_id = %u, data", msg->dev_id, msg->msg_id);
|
||||
fprintf(f, "p: dev_id = %u, msg_id = %4u, data", msg->dev_id, msg->msg_id);
|
||||
|
||||
for (int i = 0; i < msg->msg_len / sizeof(double); i++)
|
||||
fprintf(f, "\t%f", msg->data[i]);
|
||||
fprintf(f, "%8.3f", msg->data[i]);
|
||||
|
||||
fprintf(f, "\n");
|
||||
}
|
||||
|
|
|
@ -128,5 +128,4 @@ int node_recv(struct node *n, struct msg *m)
|
|||
print(ERROR, "Recv failed: %s", strerror(errno));
|
||||
|
||||
print(DEBUG, "Message received from node %s", n->name);
|
||||
msg_fprint(stdout, m);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ void print(enum log_level lvl, const char *fmt, ...)
|
|||
|
||||
clock_gettime(CLOCK_REALTIME, &ts);
|
||||
|
||||
printf("%lu.%lu [%-7s] ", (long) ts.tv_sec, (long) ts.tv_nsec / 1000, log_prefix[lvl]);
|
||||
printf("%14.3f [%-7s] ", ts.tv_sec + ts.tv_nsec / 1e9, log_prefix[lvl]);
|
||||
vprintf(fmt, ap);
|
||||
printf("\n");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue