Skip to content

Commit

Permalink
quick-logs -> log_interval
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Ortmann committed Oct 6, 2023
1 parent 45445f2 commit 5e12bb9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 21 deletions.
7 changes: 2 additions & 5 deletions eggdrop.conf
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,8 @@ set max-logs 20
# have keep-all-logs 0 (OFF).
set max-logsize 0

# This could be good if you have had problem with the logfile filling
# your quota/hard disk or if you log +p and publish it to the web and
# need more up-to-date info. Note that this setting might increase the
# CPU usage of your bot (on the other hand it will decrease your mem usage).
set quick-logs 0
# Interval between logfile saving operations in seconds.
set log-interval 15

# This setting allows you the logging of raw incoming server traffic via
# console/log flag 'r', raw outgoing server traffic via console/log mode 'v',
Expand Down
18 changes: 9 additions & 9 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
#endif

extern char origbotname[], botnetnick[];
extern int dcc_total, conmask, cache_hit, cache_miss, max_logs, quick_logs,
extern int dcc_total, conmask, cache_hit, cache_miss, max_logs, log_interval,
quiet_save;
extern struct dcc_t *dcc;
extern struct userrec *userlist;
Expand Down Expand Up @@ -141,6 +141,7 @@ char ver[41]; /* Version info (short form) */
volatile sig_atomic_t do_restart = 0; /* .restart has been called, restart ASAP */
int resolve_timeout = RES_TIMEOUT; /* Hostname/address lookup timeout */
char quit_msg[1024]; /* Quit message */
int log_elapsed = 1;

/* Moved here for n flag warning, put back in do_arg if removed */
unsigned char cliflags = 0;
Expand Down Expand Up @@ -637,6 +638,13 @@ static void core_secondly()
tell_mem_status_dcc(DP_STDOUT);
}
}
if (log_elapsed < log_interval)
log_elapsed++;
else {
flushlogs();
check_logsize();
log_elapsed = 1;
}
nowmins = time(NULL) / 60;
if (nowmins > lastmin) {
memcpy(&nowtm, localtime(&now), sizeof(struct tm));
Expand All @@ -662,10 +670,6 @@ static void core_secondly()
if (((int) (nowtm.tm_min / 5) * 5) == (nowtm.tm_min)) { /* 5 min */
call_hook(HOOK_5MINUTELY);
check_botnet_pings();
if (!quick_logs) {
flushlogs();
check_logsize();
}
if (!miltime) { /* At midnight */
char s[25];
int j;
Expand Down Expand Up @@ -713,10 +717,6 @@ static void core_minutely()
{
check_tcl_time_and_cron(&nowtm);
do_check_timers(&timer);
if (quick_logs != 0) {
flushlogs();
check_logsize();
}
}

static void core_hourly()
Expand Down
8 changes: 3 additions & 5 deletions src/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ extern struct chanset_t *chanset;

extern char helpdir[], version[], origbotname[], botname[], admin[], network[],
motdfile[], ver[], botnetnick[], bannerfile[], textdir[];
extern int backgrd, con_chan, term_z, use_stderr, dcc_total, keep_all_logs,
quick_logs;
extern int backgrd, con_chan, term_z, use_stderr, dcc_total, keep_all_logs;

extern time_t now;
extern Tcl_Interp *interp;
Expand Down Expand Up @@ -707,9 +706,8 @@ void flushlogs()
*/
for (i = 0; i < max_logs; i++) {
if (logs[i].f != NULL) {
if ((logs[i].repeats > 0) && quick_logs) {
/* Repeat.. if quicklogs used then display 'last message
* repeated x times' and reset repeats.
if (logs[i].repeats > 0) {
/* Repeat.. display 'last message repeated x times' and reset repeats.
*/
char stamp[33];

Expand Down
4 changes: 2 additions & 2 deletions src/tcl.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ int must_be_owner = 1;
int quiet_reject = 1;
int copy_to_tmp = 1;
int max_socks = 100;
int quick_logs = 0;
int log_interval = 15;
int par_telnet_flood = 1;
int quiet_save = 0;
int strtot = 0;
Expand Down Expand Up @@ -481,7 +481,7 @@ static tcl_ints def_tcl_ints[] = {
{"max-socks", &max_socks, 0},
{"max-logs", &max_logs, 0},
{"max-logsize", &max_logsize, 0},
{"quick-logs", &quick_logs, 0},
{"log-interval", &log_interval, 0},
{"raw-log", &raw_log, 1},
{"protect-telnet", &protect_telnet, 0},
{"dcc-sanitycheck", &dcc_sanitycheck, 0},
Expand Down

0 comments on commit 5e12bb9

Please sign in to comment.