mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Tidied up logging functions
This commit is contained in:
parent
5eaf687d98
commit
39627be1f5
2
Makefile
2
Makefile
@ -13,3 +13,5 @@ profanity.o: log.h
|
|||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
rm -f profanity
|
rm -f profanity
|
||||||
|
rm -f profanity.log
|
||||||
|
rm *.o
|
||||||
|
5
log.c
5
log.c
@ -17,6 +17,11 @@ xmpp_log_t *xmpp_get_file_logger()
|
|||||||
|
|
||||||
void xmpp_file_logger(void * const userdata, const xmpp_log_level_t level,
|
void xmpp_file_logger(void * const userdata, const xmpp_log_level_t level,
|
||||||
const char * const area, const char * const msg)
|
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);
|
fprintf(logp, "%s DEBUG %s\n", area, msg);
|
||||||
}
|
}
|
||||||
|
1
log.h
1
log.h
@ -5,5 +5,6 @@
|
|||||||
FILE *logp;
|
FILE *logp;
|
||||||
|
|
||||||
xmpp_log_t *xmpp_get_file_logger();
|
xmpp_log_t *xmpp_get_file_logger();
|
||||||
|
void logmsg(const char * const area, const char * const msg);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
10
profanity.c
10
profanity.c
@ -9,6 +9,9 @@
|
|||||||
// refernce to log
|
// refernce to log
|
||||||
extern FILE *logp;
|
extern FILE *logp;
|
||||||
|
|
||||||
|
// area for log message in profanity
|
||||||
|
static const char *prof = "prof";
|
||||||
|
|
||||||
// chat windows
|
// chat windows
|
||||||
static WINDOW *incoming_border;
|
static WINDOW *incoming_border;
|
||||||
static WINDOW *outgoing_border;
|
static WINDOW *outgoing_border;
|
||||||
@ -49,7 +52,7 @@ int main(void)
|
|||||||
xmpp_log_t *log;
|
xmpp_log_t *log;
|
||||||
|
|
||||||
logp = fopen("profanity.log", "a");
|
logp = fopen("profanity.log", "a");
|
||||||
fprintf(logp, "Starting Profanity...\n");
|
logmsg(prof, "Starting Profanity...");
|
||||||
|
|
||||||
init();
|
init();
|
||||||
print_title();
|
print_title();
|
||||||
@ -64,7 +67,10 @@ int main(void)
|
|||||||
getstr(passwd);
|
getstr(passwd);
|
||||||
echo();
|
echo();
|
||||||
|
|
||||||
fprintf(logp, "Log in, user = %s\n", user);
|
char loginmsg[100];
|
||||||
|
sprintf(loginmsg, "User <%s> logged in", user);
|
||||||
|
logmsg(prof, loginmsg);
|
||||||
|
//fprintf(logp, "Log in, user = %s\n", user);
|
||||||
|
|
||||||
xmpp_initialize();
|
xmpp_initialize();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user