1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Moved XMPP logging to jabber.c

This commit is contained in:
James Booth 2012-02-12 22:10:30 +00:00
parent 7aa1d931a0
commit af46792871
3 changed files with 16 additions and 18 deletions

View File

@ -12,6 +12,22 @@ static xmpp_log_t *_log;
static xmpp_ctx_t *_ctx; static xmpp_ctx_t *_ctx;
static xmpp_conn_t *_conn; static xmpp_conn_t *_conn;
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)
{
log_msg(area, msg);
}
// private XMPP handlers // private XMPP handlers
static void _jabber_conn_handler(xmpp_conn_t * const conn, static void _jabber_conn_handler(xmpp_conn_t * const conn,
const xmpp_conn_event_t status, const int error, const xmpp_conn_event_t status, const int error,

17
log.c
View File

@ -1,26 +1,9 @@
#include <stdio.h> #include <stdio.h>
#include <strophe/strophe.h>
#include "log.h" #include "log.h"
extern FILE *logp; 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)
{
log_msg(area, msg);
}
void log_msg(const char * const area, const char * const msg) void log_msg(const char * const area, const char * const msg)
{ {
fprintf(logp, "%s DEBUG: %s\n", area, msg); fprintf(logp, "%s DEBUG: %s\n", area, msg);

1
log.h
View File

@ -12,7 +12,6 @@
// file log // file log
FILE *logp; FILE *logp;
xmpp_log_t *xmpp_get_file_logger();
void log_init(void); void log_init(void);
void log_msg(const char * const area, const char * const msg); void log_msg(const char * const area, const char * const msg);
void log_close(void); void log_close(void);