2012-02-05 10:10:10 -05:00
|
|
|
#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)
|
2012-02-05 10:22:02 -05:00
|
|
|
{
|
2012-02-06 19:08:59 -05:00
|
|
|
log_msg(area, msg);
|
2012-02-05 10:22:02 -05:00
|
|
|
}
|
|
|
|
|
2012-02-06 19:08:59 -05:00
|
|
|
void log_msg(const char * const area, const char * const msg)
|
2012-02-05 10:10:10 -05:00
|
|
|
{
|
2012-02-06 17:29:05 -05:00
|
|
|
fprintf(logp, "%s DEBUG: %s\n", area, msg);
|
2012-02-05 10:10:10 -05:00
|
|
|
}
|
|
|
|
|
2012-02-06 19:08:59 -05:00
|
|
|
void log_init(void)
|
2012-02-06 17:29:05 -05:00
|
|
|
{
|
|
|
|
logp = fopen("profanity.log", "a");
|
2012-02-06 19:08:59 -05:00
|
|
|
log_msg(PROF, "Starting Profanity...");
|
|
|
|
}
|
|
|
|
|
|
|
|
void log_close(void)
|
|
|
|
{
|
|
|
|
fclose(logp);
|
2012-02-06 17:29:05 -05:00
|
|
|
}
|