Add configuration directive to be able not to log bip information (not irc related, that is)
This commit is contained in:
parent
46bc59b0a6
commit
6273cf2d59
@ -109,6 +109,10 @@ Ignored for the time beeing.
|
|||||||
When true, the log system is enabled. Else, BIP will not write a single log
|
When true, the log system is enabled. Else, BIP will not write a single log
|
||||||
file. Backlog is then stored into memory.
|
file. Backlog is then stored into memory.
|
||||||
|
|
||||||
|
.TP
|
||||||
|
\fBlog_system\fP (default: \fBtrue\fP)
|
||||||
|
When true, system messages such as connection errors are logged. Else, BIP will not write system logs.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fBlog_format\fP (default: \fB%u/%n/%Y-%m/%c.%d.log\fP)
|
\fBlog_format\fP (default: \fB%u/%n/%Y-%m/%c.%d.log\fP)
|
||||||
Determines the log file name depending on :
|
Determines the log file name depending on :
|
||||||
|
@ -44,7 +44,10 @@ my %optdesc = (
|
|||||||
'desc' => 'Where do you want the pidfile to be stored ?' },
|
'desc' => 'Where do you want the pidfile to be stored ?' },
|
||||||
'log' => { 'type' => 'b', 'adv' => 0, 'default' => 'true',
|
'log' => { 'type' => 'b', 'adv' => 0, 'default' => 'true',
|
||||||
'optional' => 1,
|
'optional' => 1,
|
||||||
'desc' => 'Do you want to enable the logging system ?' },
|
'desc' => 'Do you want to enable channel logging ?' },
|
||||||
|
'log_system' => { 'type' => 'b', 'adv' => 0, 'default' => 'true',
|
||||||
|
'optional' => 1,
|
||||||
|
'desc' => 'Do you want to enable system logging ?' },
|
||||||
'log_sync_interval' => { 'type' => 'i', 'adv' => 1,
|
'log_sync_interval' => { 'type' => 'i', 'adv' => 1,
|
||||||
'optional' => 1,
|
'optional' => 1,
|
||||||
'default' => '5', 'depends' => 'log', 'depval' => 'true',
|
'default' => '5', 'depends' => 'log', 'depval' => 'true',
|
||||||
|
@ -49,6 +49,7 @@ hash_t adm_users;
|
|||||||
int conf_backlog = 0;
|
int conf_backlog = 0;
|
||||||
extern int conf_memlog;
|
extern int conf_memlog;
|
||||||
int conf_log = 0;
|
int conf_log = 0;
|
||||||
|
int conf_log_system = 0;
|
||||||
/* number of lines in backlog */
|
/* number of lines in backlog */
|
||||||
int conf_backlog_lines = 10;
|
int conf_backlog_lines = 10;
|
||||||
int conf_backlog_no_timestamp = 0;
|
int conf_backlog_no_timestamp = 0;
|
||||||
@ -180,7 +181,7 @@ static pid_t daemonize(void)
|
|||||||
_exit(0);
|
_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conf_log) {
|
if (conf_log_system) {
|
||||||
snprintf(buf, 4095, "%s/bip.log", conf_log_root);
|
snprintf(buf, 4095, "%s/bip.log", conf_log_root);
|
||||||
FILE *f = fopen(buf, "a");
|
FILE *f = fopen(buf, "a");
|
||||||
if (!f)
|
if (!f)
|
||||||
@ -621,6 +622,9 @@ int fireup(FILE *conf)
|
|||||||
case LEX_LOG:
|
case LEX_LOG:
|
||||||
conf_log = t->ndata;
|
conf_log = t->ndata;
|
||||||
break;
|
break;
|
||||||
|
case LEX_LOG_SYSTEM:
|
||||||
|
conf_log_system = t->ndata;
|
||||||
|
break;
|
||||||
case LEX_BACKLOG_LINES:
|
case LEX_BACKLOG_LINES:
|
||||||
conf_backlog_lines = t->ndata;
|
conf_backlog_lines = t->ndata;
|
||||||
break;
|
break;
|
||||||
@ -935,6 +939,7 @@ int main(int argc, char **argv)
|
|||||||
conf_log_level = LOG_INFO;
|
conf_log_level = LOG_INFO;
|
||||||
conf_backlog = 1;
|
conf_backlog = 1;
|
||||||
conf_log = 1;
|
conf_log = 1;
|
||||||
|
conf_log_system = 1;
|
||||||
conf_backlog_lines = 100;
|
conf_backlog_lines = 100;
|
||||||
conf_log_sync_interval = 5;
|
conf_log_sync_interval = 5;
|
||||||
conf_daemonize = 1;
|
conf_daemonize = 1;
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
int conf_log_level;
|
int conf_log_level;
|
||||||
FILE *conf_global_log_file;
|
FILE *conf_global_log_file;
|
||||||
int conf_log;
|
int conf_log_system;
|
||||||
|
|
||||||
void readpass(char *buffer, int buflen)
|
void readpass(char *buffer, int buflen)
|
||||||
{
|
{
|
||||||
|
@ -80,7 +80,7 @@ struct tuple *tuple_l_new(int type, void *p)
|
|||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%token LEX_IP LEX_EQ LEX_PORT LEX_CSS LEX_SEMICOLON LEX_CONNECTION LEX_NETWORK LEX_LBRA LEX_RBRA LEX_USER LEX_NAME LEX_NICK LEX_SERVER LEX_PASSWORD LEX_SRCIP LEX_HOST LEX_VHOST LEX_SOURCE_PORT LEX_NONE LEX_COMMENT LEX_BUNCH LEX_REALNAME LEX_SSL LEX_SSL_CHECK_MODE LEX_SSL_CHECK_STORE LEX_CHANNEL LEX_KEY LEX_LOG_ROOT LEX_LOG_FORMAT LEX_LOG_LEVEL LEX_BACKLOG_LINES LEX_BACKLOG_NO_TIMESTAMP LEX_BACKLOG LEX_LOG LEX_LOG_SYNC_INTERVAL LEX_FOLLOW_NICK LEX_ON_CONNECT_SEND LEX_AWAY_NICK LEX_PID_FILE LEX_IGN_FIRST_NICK LEX_ALWAYS_BACKLOG LEX_BLRESET_ON_TALK LEX_DEFAULT_USER LEX_DEFAULT_NICK LEX_DEFAULT_REALNAME LEX_NO_CLIENT_AWAY_MSG LEX_BL_MSG_ONLY
|
%token LEX_IP LEX_EQ LEX_PORT LEX_CSS LEX_SEMICOLON LEX_CONNECTION LEX_NETWORK LEX_LBRA LEX_RBRA LEX_USER LEX_NAME LEX_NICK LEX_SERVER LEX_PASSWORD LEX_SRCIP LEX_HOST LEX_VHOST LEX_SOURCE_PORT LEX_NONE LEX_COMMENT LEX_BUNCH LEX_REALNAME LEX_SSL LEX_SSL_CHECK_MODE LEX_SSL_CHECK_STORE LEX_CHANNEL LEX_KEY LEX_LOG_ROOT LEX_LOG_FORMAT LEX_LOG_LEVEL LEX_BACKLOG_LINES LEX_BACKLOG_NO_TIMESTAMP LEX_BACKLOG LEX_LOG LEX_LOG_SYSTEM LEX_LOG_SYNC_INTERVAL LEX_FOLLOW_NICK LEX_ON_CONNECT_SEND LEX_AWAY_NICK LEX_PID_FILE LEX_IGN_FIRST_NICK LEX_ALWAYS_BACKLOG LEX_BLRESET_ON_TALK LEX_DEFAULT_USER LEX_DEFAULT_NICK LEX_DEFAULT_REALNAME LEX_NO_CLIENT_AWAY_MSG LEX_BL_MSG_ONLY
|
||||||
|
|
||||||
%union {
|
%union {
|
||||||
int number;
|
int number;
|
||||||
@ -120,6 +120,7 @@ command:
|
|||||||
$$ = tuple_i_new(LEX_BL_MSG_ONLY, $3);
|
$$ = tuple_i_new(LEX_BL_MSG_ONLY, $3);
|
||||||
}
|
}
|
||||||
| LEX_LOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_LOG, $3); }
|
| LEX_LOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_LOG, $3); }
|
||||||
|
| LEX_LOG_SYSTEM LEX_EQ LEX_BOOL { $$ = tuple_i_new(LEX_LOG_SYSTEM, $3); }
|
||||||
| LEX_ALWAYS_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(
|
| LEX_ALWAYS_BACKLOG LEX_EQ LEX_BOOL { $$ = tuple_i_new(
|
||||||
LEX_ALWAYS_BACKLOG, $3); }
|
LEX_ALWAYS_BACKLOG, $3); }
|
||||||
| LEX_LOG_SYNC_INTERVAL LEX_EQ LEX_INT { $$ = tuple_i_new(
|
| LEX_LOG_SYNC_INTERVAL LEX_EQ LEX_INT { $$ = tuple_i_new(
|
||||||
|
@ -2197,6 +2197,7 @@ void bip_init(bip_t *bip)
|
|||||||
memset(bip, 0, sizeof(bip_t));
|
memset(bip, 0, sizeof(bip_t));
|
||||||
list_init(&bip->link_list, list_ptr_cmp);
|
list_init(&bip->link_list, list_ptr_cmp);
|
||||||
list_init(&bip->conn_list, list_ptr_cmp);
|
list_init(&bip->conn_list, list_ptr_cmp);
|
||||||
|
list_init(&bip->connecting_client_list, list_ptr_cmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bip_recover_sighup(bip_t *bip)
|
void bip_recover_sighup(bip_t *bip)
|
||||||
|
@ -90,6 +90,7 @@ list_t *parse_conf(FILE *file)
|
|||||||
"bl_msg_only" { return LEX_BL_MSG_ONLY; }
|
"bl_msg_only" { return LEX_BL_MSG_ONLY; }
|
||||||
"always_backlog" { return LEX_ALWAYS_BACKLOG; }
|
"always_backlog" { return LEX_ALWAYS_BACKLOG; }
|
||||||
"log" { return LEX_LOG; }
|
"log" { return LEX_LOG; }
|
||||||
|
"log_system" { return LEX_LOG_SYSTEM; }
|
||||||
"log_sync_interval" { return LEX_LOG_SYNC_INTERVAL; }
|
"log_sync_interval" { return LEX_LOG_SYNC_INTERVAL; }
|
||||||
"follow_nick" { return LEX_FOLLOW_NICK; }
|
"follow_nick" { return LEX_FOLLOW_NICK; }
|
||||||
"ignore_first_nick" { return LEX_IGN_FIRST_NICK; }
|
"ignore_first_nick" { return LEX_IGN_FIRST_NICK; }
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
extern int conf_log_level;
|
extern int conf_log_level;
|
||||||
extern int conf_log;
|
extern int conf_log_system;
|
||||||
extern int errno;
|
extern int errno;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -119,7 +119,7 @@ void mylog(int level, char *fmt, ...)
|
|||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
if (!conf_log)
|
if (!conf_log_system)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
Loading…
Reference in New Issue
Block a user