mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
Revert my addition of callback cleaner and instead use existing functionality for temporary log files
This commit is contained in:
parent
0bfa616e2e
commit
5c1c117b8e
@ -889,29 +889,6 @@ add_temp_log(int min_severity)
|
|||||||
UNLOCK_LOGS();
|
UNLOCK_LOGS();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CALLBACK_FILENAME "<callback>"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the latest log handler added, if that log handler is a callback
|
|
||||||
* handler.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
remove_log_callback(void)
|
|
||||||
{
|
|
||||||
if(logfiles && !strcmp(logfiles->filename, CALLBACK_FILENAME)) {
|
|
||||||
logfile_t *lf = logfiles;
|
|
||||||
|
|
||||||
LOCK_LOGS();
|
|
||||||
logfiles = lf->next;
|
|
||||||
log_global_min_severity_ = get_min_log_level();
|
|
||||||
UNLOCK_LOGS();
|
|
||||||
|
|
||||||
tor_free(lf->filename);
|
|
||||||
tor_free(lf->severities);
|
|
||||||
tor_free(lf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a log handler to send messages in <b>severity</b>
|
* Add a log handler to send messages in <b>severity</b>
|
||||||
* to the function <b>cb</b>.
|
* to the function <b>cb</b>.
|
||||||
@ -923,7 +900,7 @@ add_callback_log(const log_severity_list_t *severity, log_callback cb)
|
|||||||
lf = tor_malloc_zero(sizeof(logfile_t));
|
lf = tor_malloc_zero(sizeof(logfile_t));
|
||||||
lf->fd = -1;
|
lf->fd = -1;
|
||||||
lf->severities = tor_memdup(severity, sizeof(log_severity_list_t));
|
lf->severities = tor_memdup(severity, sizeof(log_severity_list_t));
|
||||||
lf->filename = tor_strdup(CALLBACK_FILENAME);
|
lf->filename = tor_strdup("<callback>");
|
||||||
lf->callback = cb;
|
lf->callback = cb;
|
||||||
lf->next = logfiles;
|
lf->next = logfiles;
|
||||||
|
|
||||||
|
@ -138,7 +138,6 @@ int add_file_log(const log_severity_list_t *severity, const char *filename,
|
|||||||
int add_syslog_log(const log_severity_list_t *severity,
|
int add_syslog_log(const log_severity_list_t *severity,
|
||||||
const char* syslog_identity_tag);
|
const char* syslog_identity_tag);
|
||||||
#endif
|
#endif
|
||||||
void remove_log_callback(void);
|
|
||||||
int add_callback_log(const log_severity_list_t *severity, log_callback cb);
|
int add_callback_log(const log_severity_list_t *severity, log_callback cb);
|
||||||
void logs_set_domain_logging(int enabled);
|
void logs_set_domain_logging(int enabled);
|
||||||
int get_min_log_level(void);
|
int get_min_log_level(void);
|
||||||
|
@ -50,6 +50,7 @@ setup_log_callback(void)
|
|||||||
lst.masks[LOG_WARN - LOG_ERR] = ~0;
|
lst.masks[LOG_WARN - LOG_ERR] = ~0;
|
||||||
lst.masks[LOG_NOTICE - LOG_ERR] = ~0;
|
lst.masks[LOG_NOTICE - LOG_ERR] = ~0;
|
||||||
add_callback_log(&lst, log_cback);
|
add_callback_log(&lst, log_cback);
|
||||||
|
mark_logs_temp();
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
@ -200,7 +201,7 @@ test_options_validate(void *arg)
|
|||||||
"We're a bridge but DirCache is disabled.");
|
"We're a bridge but DirCache is disabled.");
|
||||||
|
|
||||||
clear_log_messages();
|
clear_log_messages();
|
||||||
remove_log_callback();
|
close_temp_logs();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user