mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Removed log function to log.c
This commit is contained in:
parent
7d6ce4da02
commit
c90c83f7e1
16
src/log.c
16
src/log.c
@ -20,6 +20,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -161,6 +162,21 @@ log_msg(log_level_t level, const char * const area, const char * const msg)
|
||||
}
|
||||
}
|
||||
|
||||
log_level_t
|
||||
log_level_from_string(char *log_level)
|
||||
{
|
||||
assert(log_level != NULL);
|
||||
if (strcmp(log_level, "DEBUG") == 0) {
|
||||
return PROF_LEVEL_DEBUG;
|
||||
} else if (strcmp(log_level, "INFO") == 0) {
|
||||
return PROF_LEVEL_INFO;
|
||||
} else if (strcmp(log_level, "WARN") == 0) {
|
||||
return PROF_LEVEL_WARN;
|
||||
} else {
|
||||
return PROF_LEVEL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_rotate_log_file(void)
|
||||
{
|
||||
|
@ -45,6 +45,7 @@ void log_warning(const char * const msg, ...);
|
||||
void log_error(const char * const msg, ...);
|
||||
void log_msg(log_level_t level, const char * const area,
|
||||
const char * const msg);
|
||||
log_level_t log_level_from_string(char *log_level);
|
||||
|
||||
void chat_log_init(void);
|
||||
void chat_log_chat(const gchar * const login, gchar *other,
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include "ui/ui.h"
|
||||
#include "xmpp/xmpp.h"
|
||||
|
||||
static log_level_t _get_log_level(char *log_level);
|
||||
static gboolean _process_input(char *inp);
|
||||
static void _handle_idle_time(void);
|
||||
static void _init(const int disable_tls, char *log_level);
|
||||
@ -395,20 +394,6 @@ prof_handle_activity(void)
|
||||
}
|
||||
}
|
||||
|
||||
static log_level_t
|
||||
_get_log_level(char *log_level)
|
||||
{
|
||||
if (strcmp(log_level, "DEBUG") == 0) {
|
||||
return PROF_LEVEL_DEBUG;
|
||||
} else if (strcmp(log_level, "INFO") == 0) {
|
||||
return PROF_LEVEL_INFO;
|
||||
} else if (strcmp(log_level, "WARN") == 0) {
|
||||
return PROF_LEVEL_WARN;
|
||||
} else {
|
||||
return PROF_LEVEL_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Take a line of input and process it, return TRUE if profanity is to
|
||||
* continue, FALSE otherwise
|
||||
@ -507,7 +492,7 @@ _init(const int disable_tls, char *log_level)
|
||||
// ignore SIGPIPE
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
_create_directories();
|
||||
log_level_t prof_log_level = _get_log_level(log_level);
|
||||
log_level_t prof_log_level = log_level_from_string(log_level);
|
||||
log_init(prof_log_level);
|
||||
if (strcmp(PACKAGE_STATUS, "development") == 0) {
|
||||
log_info("Starting Profanity (%sdev)...", PACKAGE_VERSION);
|
||||
|
Loading…
Reference in New Issue
Block a user