mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 18:22:50 +01:00
Splitted open_logfiles(); into open_logfiles(); and close_logfiles();, use the second one on ircd_shutdown
This commit is contained in:
parent
fd5af3d072
commit
ea82a3ca27
3 changed files with 22 additions and 9 deletions
|
@ -55,6 +55,7 @@ struct Client;
|
|||
|
||||
extern void init_main_logfile(void);
|
||||
extern void open_logfiles(void);
|
||||
extern void close_logfiles(void);
|
||||
extern void ilog(ilogfile dest, const char *fmt, ...) AFP(2, 3);
|
||||
extern void inotice(const char *fmt, ...) AFP(1, 2);
|
||||
extern void iwarn(const char *fmt, ...) AFP(1, 2);
|
||||
|
|
|
@ -164,6 +164,7 @@ ircd_shutdown(const char *reason)
|
|||
}
|
||||
|
||||
ilog(L_MAIN, "Server Terminating. %s", reason);
|
||||
close_logfiles();
|
||||
|
||||
unlink(pidFileName);
|
||||
exit(0);
|
||||
|
|
25
src/logger.c
25
src/logger.c
|
@ -86,24 +86,35 @@ open_logfiles(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
if(log_main != NULL)
|
||||
fclose(log_main);
|
||||
close_logfiles();
|
||||
|
||||
log_main = fopen(logFileName, "a");
|
||||
|
||||
/* log_main is handled above, so just do the rest */
|
||||
for(i = 1; i < LAST_LOGFILE; i++)
|
||||
{
|
||||
/* close open logfiles */
|
||||
/* reopen those with paths */
|
||||
if(!EmptyString(*log_table[i].name))
|
||||
*log_table[i].logfile = fopen(*log_table[i].name, "a");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
close_logfiles(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if(log_main != NULL)
|
||||
fclose(log_main);
|
||||
|
||||
/* log_main is handled above, so just do the rest */
|
||||
for(i = 1; i < LAST_LOGFILE; i++)
|
||||
{
|
||||
if(*log_table[i].logfile != NULL)
|
||||
{
|
||||
fclose(*log_table[i].logfile);
|
||||
*log_table[i].logfile = NULL;
|
||||
}
|
||||
|
||||
/* reopen those with paths */
|
||||
if(!EmptyString(*log_table[i].name))
|
||||
*log_table[i].logfile = fopen(*log_table[i].name, "a");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue