Adder logger

This commit is contained in:
James Booth
2015-05-16 01:10:32 +01:00
parent fe1f94cd93
commit 7e094d8c72
8 changed files with 253 additions and 71 deletions

View File

@@ -4,6 +4,7 @@
#include <glib.h>
#include "server/stanza.h"
#include "server/log.h"
static GList *stanzas;
@@ -31,24 +32,24 @@ stanza_new(const char *name, const char **attributes)
void
stanza_show(XMPPStanza *stanza)
{
printf("NAME : %s\n", stanza->name);
log_println("NAME : %s", stanza->name);
if (stanza->content && stanza->content->len > 0) {
printf("CONTENT: %s\n", stanza->content->str);
log_println("CONTENT: %s", stanza->content->str);
}
if (stanza->attrs) {
GList *curr_attr = stanza->attrs;
while (curr_attr) {
XMPPAttr *attr = curr_attr->data;
printf("ATTR : %s='%s'\n", attr->name, attr->value);
log_println("ATTR : %s='%s'", attr->name, attr->value);
curr_attr = g_list_next(curr_attr);
}
}
if (stanza->children) {
printf("CHILDREN:\n");
log_println("CHILDREN:");
GList *curr_child = stanza->children;
while (curr_child) {
XMPPStanza *child = curr_child->data;
@@ -65,7 +66,7 @@ stanza_show_all(void)
while (curr) {
XMPPStanza *stanza = curr->data;
stanza_show(stanza);
printf("\n");
log_println("");
curr = g_list_next(curr);
}
}