clean README and TODO files

loglevels cleanup
debug prints cleanup
log info when connecting to a server
default log level to INFO
This commit is contained in:
kyoshiro 2005-11-17 17:55:12 +00:00
parent ad86ed411d
commit 1e6f0593fb
10 changed files with 27 additions and 50 deletions

14
IDEAS
View File

@ -1,14 +0,0 @@
- parser limité aux join part mode kick kill privmsg notices quit nick names
- parser client : join, part, quit, nick, privmsg/notice
- gestion des chans avec liste des nicks et statut
- backlog avec timestamp à la reconnexion
- logs au format irssi + timestamp complet
- parser de conf (lex) du style var = value
- backlog dans un dir, plusieurs fichiers (un par chan + le reste dans un autre)
- [secondaire] rotate logs
- connection.c: conn, read/write polls, waitevent, ssl transparent et anti flood
- irc.c: gestion des chans, des spécificités d'un client IRC (ping)
- log.c: log et backlog
- client.c: gestion des clients (auth, etc...)
- config.c: lecture et enregistrement de la conf

2
README
View File

@ -1,2 +0,0 @@
log encryption support
salt this md5

8
TODO
View File

@ -1,12 +1,6 @@
Before release:
- SSL certificate verification
- keep invites when detached ? - keep invites when detached ?
- allow global (or per net ?) IP filtering - allow global (or per net ?) IP filtering
- /bip command for admin (at least rehash, jump, ...) - more /bip commands
- check why log_mode doesn't add closing bracket...
- bug: bip using 100% cpu when reconnecting (to SSL only ?)
TODO:
- DCC proxying... - DCC proxying...
- crypt logs - crypt logs

View File

@ -245,8 +245,8 @@ pid_is_there:
} }
if (pid) if (pid)
mylog(LOG_INFO, "pid file found (pid %ld).", pid); mylog(LOG_INFO, "pid file found (pid %ld).", pid);
mylog(LOG_INFO, "Another instance of bip is certainly runing."); mylog(LOG_STD, "Another instance of bip is certainly runing.");
mylog(LOG_INFO, "If you are sure this is not the case remove" mylog(LOG_STD, "If you are sure this is not the case remove"
" %s.", conf_pid_file); " %s.", conf_pid_file);
exit(2); exit(2);
} }
@ -769,7 +769,6 @@ void ircize(list_t *ll)
struct c_channel *chan = struct c_channel *chan =
list_it_item(&chit); list_it_item(&chit);
struct chan_info *ci = chan_info_new(); struct chan_info *ci = chan_info_new();
printf("%s\n",chan->name);
ci->name = strdup(chan->name); ci->name = strdup(chan->name);
ci->key = strmaydup(chan->key); ci->key = strmaydup(chan->key);
hash_insert(&link->chan_infos, hash_insert(&link->chan_infos,
@ -891,7 +890,7 @@ int main(int argc, char **argv)
conf_log_root = NULL; conf_log_root = NULL;
conf_log_format = NULL; conf_log_format = NULL;
conf_log_level = LOG_ERROR; conf_log_level = LOG_INFO;
conf_backlog = 1; conf_backlog = 1;
conf_log = 1; conf_log = 1;
conf_backlog_lines = 100; conf_backlog_lines = 100;

View File

@ -1,7 +1,7 @@
/* A Bison parser, made by GNU Bison 1.875d. */ /* A Bison parser, made by GNU Bison 2.1. */
/* Skeleton parser for Yacc-like parsing with Bison, /* Skeleton parser for Yacc-like parsing with Bison,
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -15,8 +15,8 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111-1307, USA. */ Boston, MA 02110-1301, USA. */
/* As a special exception, when this file is copied by Bison into a /* As a special exception, when this file is copied by Bison into a
Bison output file, you may use that output file without restriction. Bison output file, you may use that output file without restriction.
@ -80,6 +80,7 @@
LEX_STRING = 306 LEX_STRING = 306
}; };
#endif #endif
/* Tokens. */
#define LEX_IP 258 #define LEX_IP 258
#define LEX_EQ 259 #define LEX_EQ 259
#define LEX_PORT 260 #define LEX_PORT 260
@ -141,8 +142,8 @@ typedef union YYSTYPE {
void *list; void *list;
struct tuple *tuple; struct tuple *tuple;
} YYSTYPE; } YYSTYPE;
/* Line 1285 of yacc.c. */ /* Line 1447 of yacc.c. */
#line 146 "y.tab.h" #line 147 "y.tab.h"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_TRIVIAL 1

View File

@ -1071,8 +1071,6 @@ static connection_t *_connection_new(char *dsthostname, char *dstport,
{ {
connection_t *conn; connection_t *conn;
printf("%s\n", dsthostname);
conn = connection_init(1, 0, timeout, 0); conn = connection_init(1, 0, timeout, 0);
create_socket(dsthostname, dstport, srchostname, srcport, conn); create_socket(dsthostname, dstport, srchostname, srcport, conn);

View File

@ -1870,6 +1870,10 @@ connection_t *irc_server_connect(struct link *link)
struct link_server *ls; struct link_server *ls;
connection_t *conn; connection_t *conn;
mylog(LOG_INFO, "Connecting user '%s' to network '%s' using server "
"%s:%d", link->username, link->name,
link->serverv[link->cur_server]->host,
link->serverv[link->cur_server]->port);
conn = connection_new(link->serverv[link->cur_server]->host, conn = connection_new(link->serverv[link->cur_server]->host,
link->serverv[link->cur_server]->port, link->serverv[link->cur_server]->port,
link->vhost, link->bind_port, link->vhost, link->bind_port,

View File

@ -715,7 +715,7 @@ char *log_beautify(char *buf, char *dest)
int done; int done;
if (!buf) if (!buf)
mylog(LOG_INFO, "BUG!"); mylog(LOG_DEBUG, "BUG!");
p = strchr(buf, ' '); p = strchr(buf, ' ');
if (!p || !p[0] || !p[1]) if (!p || !p[0] || !p[1])
@ -850,9 +850,6 @@ char *log_beautify(char *buf, char *dest)
*p++ = '\r'; *p++ = '\r';
*p++ = '\n'; *p++ = '\n';
*p = 0; *p = 0;
#if 0
mylog(LOG_INFO, "beautify out: \"%s\"", ret);
#endif
return ret; return ret;
} }
@ -874,7 +871,7 @@ char *log_backread(log_t *logdata, char *destination)
if (!logdata->backlogging) { if (!logdata->backlogging) {
logdata->backlogging = 1; logdata->backlogging = 1;
mylog(LOG_INFO, "backlogging!"); mylog(LOG_DEBUG, "backlogging!");
if (lfg->memlog) if (lfg->memlog)
list_it_init(lfg->memlog, &lfg->backlog_it); list_it_init(lfg->memlog, &lfg->backlog_it);
else else
@ -901,12 +898,12 @@ next_file:
/* check the files containing data to backlog */ /* check the files containing data to backlog */
lf = list_it_item(&logdata->file_it); lf = list_it_item(&logdata->file_it);
if (lf != list_get_last(&lfg->file_group)) { if (lf != list_get_last(&lfg->file_group)) {
mylog(LOG_INFO, "%s not last file!", lf->filename); mylog(LOG_DEBUG, "%s not last file!", lf->filename);
/* if the file is not the current open for logging /* if the file is not the current open for logging
* (it is an old file that has been rotated) * (it is an old file that has been rotated)
* open if necessary, backlog line per line, and close */ * open if necessary, backlog line per line, and close */
if (!lf->file) { if (!lf->file) {
mylog(LOG_INFO, "opening: %s!", lf->filename); mylog(LOG_DEBUG, "opening: %s!", lf->filename);
lf->file = fopen(lf->filename, "r"); lf->file = fopen(lf->filename, "r");
if (!lf->file) { if (!lf->file) {
mylog(LOG_ERROR, "Can't open %s for reading", mylog(LOG_ERROR, "Can't open %s for reading",
@ -916,7 +913,7 @@ next_file:
return _log_wrap("Error reading logfile", return _log_wrap("Error reading logfile",
destination); destination);
} }
mylog(LOG_INFO, "seeking: %d!", lf->backlog_offset); mylog(LOG_DEBUG, "seeking: %d!", lf->backlog_offset);
if (fseek(lf->file, lf->backlog_offset, SEEK_SET)) { if (fseek(lf->file, lf->backlog_offset, SEEK_SET)) {
log_reinit(lfg); log_reinit(lfg);
free(buf); free(buf);
@ -933,9 +930,9 @@ next_file:
* then the log file is corrupted so we also * then the log file is corrupted so we also
* drop this file */ * drop this file */
if (pos == LOGLINE_MAXLEN) if (pos == LOGLINE_MAXLEN)
mylog(LOG_INFO, "logline too long"); mylog(LOG_DEBUG, "logline too long");
if (c == EOF || pos == LOGLINE_MAXLEN) { if (c == EOF || pos == LOGLINE_MAXLEN) {
mylog(LOG_INFO, "EOF: %s (%d)!", mylog(LOG_DEBUG, "EOF: %s (%d)!",
lf->filename, lf->filename,
conf_always_backlog); conf_always_backlog);
@ -969,7 +966,7 @@ next_file:
destination); destination);
} }
logdata->lastfile_seeked = 1; logdata->lastfile_seeked = 1;
mylog(LOG_INFO, "last file seedked!"); mylog(LOG_DEBUG, "last file seedked!");
} }
c = fgetc(lf->file); c = fgetc(lf->file);
@ -990,7 +987,7 @@ next_file:
lf->backlog_offset++; lf->backlog_offset++;
if (c == EOF || c == '\n' || pos == LOGLINE_MAXLEN) { if (c == EOF || c == '\n' || pos == LOGLINE_MAXLEN) {
if (pos == LOGLINE_MAXLEN) { if (pos == LOGLINE_MAXLEN) {
mylog(LOG_INFO, "logline too long"); mylog(LOG_DEBUG, "logline too long");
fseek(lf->file, 0, SEEK_END); fseek(lf->file, 0, SEEK_END);
/* in the corruption case we alwayse reset /* in the corruption case we alwayse reset
* backlog offset */ * backlog offset */
@ -1022,7 +1019,7 @@ static char *_log_wrap(char *dest, char *line)
count = snprintf(buf, LOGLINE_MAXLEN + 1, count = snprintf(buf, LOGLINE_MAXLEN + 1,
":" P_IRCMASK " PRIVMSG %s :%s\r\n", dest, line); ":" P_IRCMASK " PRIVMSG %s :%s\r\n", dest, line);
if (count >= LOGLINE_MAXLEN + 1) { if (count >= LOGLINE_MAXLEN + 1) {
mylog(LOG_INFO, "line too long"); mylog(LOG_DEBUG, "line too long");
buf[LOGLINE_MAXLEN - 2] = '\r'; buf[LOGLINE_MAXLEN - 2] = '\r';
buf[LOGLINE_MAXLEN - 1] = '\n'; buf[LOGLINE_MAXLEN - 1] = '\n';
buf[LOGLINE_MAXLEN] = 0; buf[LOGLINE_MAXLEN] = 0;

View File

@ -100,7 +100,7 @@ void _mylog(int level, char *fmt, va_list ap)
prefix = "WARNING: "; prefix = "WARNING: ";
break; break;
case LOG_INFO: case LOG_INFO:
prefix = "INFO: "; prefix = "";
break; break;
default: default:
prefix = ""; prefix = "";

View File

@ -17,12 +17,12 @@
#include <unistd.h> #include <unistd.h>
/* Warning: must be in order, 0 = less output */ /* Warning: must be in order, 0 = less output */
#define LOG_STD -1
#define LOG_FATAL 0 #define LOG_FATAL 0
#define LOG_ERROR 1 #define LOG_ERROR 1
#define LOG_WARN 2 #define LOG_WARN 2
#define LOG_INFO 3 #define LOG_INFO 3
#define LOG_DEBUG 4 #define LOG_DEBUG 4
#define LOG_STD 4
#define LOG_DEBUGVERB 5 #define LOG_DEBUGVERB 5
#define LOG_DEBUGTOOMUCH 6 #define LOG_DEBUGTOOMUCH 6