about summary refs log tree commit diff stats
path: root/log.c
blob: 4447ae3cee6c0a41272caa9b98d8bdee8d1faf00 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <strophe/strophe.h>

#include "log.h"

extern FILE *logp;

void xmpp_file_logger(void * const userdata, const xmpp_log_level_t level,
    const char * const area, const char * const msg);

static const xmpp_log_t file_log = { &xmpp_file_logger, XMPP_LEVEL_DEBUG };

xmpp_log_t *xmpp_get_file_logger()
{
    return (xmpp_log_t*) &file_log;
}

void xmpp_file_logger(void * const userdata, const xmpp_log_level_t level,
    const char * const area, const char * const msg)
{
    logmsg(area, msg);
}

void logmsg(const char * const area, const char * const msg)
{
    fprintf(logp, "%s DEBUG %s\n", area, msg);
}