mirror of
https://github.com/profanity-im/profanity.git
synced 2024-10-06 20:03:46 -04:00
Moved XMPP logging to jabber.c
This commit is contained in:
parent
7aa1d931a0
commit
af46792871
16
jabber.c
16
jabber.c
@ -12,6 +12,22 @@ static xmpp_log_t *_log;
|
||||
static xmpp_ctx_t *_ctx;
|
||||
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
|
||||
static void _jabber_conn_handler(xmpp_conn_t * const conn,
|
||||
const xmpp_conn_event_t status, const int error,
|
||||
|
17
log.c
17
log.c
@ -1,26 +1,9 @@
|
||||
#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)
|
||||
{
|
||||
log_msg(area, msg);
|
||||
}
|
||||
|
||||
void log_msg(const char * const area, const char * const msg)
|
||||
{
|
||||
fprintf(logp, "%s DEBUG: %s\n", area, msg);
|
||||
|
Loading…
Reference in New Issue
Block a user