Single log file

This commit is contained in:
topjohnwu 2018-07-02 22:48:26 +08:00
parent a8030c39b1
commit c88dc8795b
2 changed files with 2 additions and 16 deletions

View File

@ -22,8 +22,7 @@ static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
enum { enum {
HIDE_EVENT, HIDE_EVENT,
LOG_EVENT, LOG_EVENT
DEBUG_EVENT
}; };
struct log_listener { struct log_listener {
@ -36,12 +35,7 @@ static int am_proc_start_filter(const char *log) {
} }
static int magisk_log_filter(const char *log) { static int magisk_log_filter(const char *log) {
char *ss; return !am_proc_start_filter(log);
return (ss = strstr(log, " Magisk")) && (ss[-1] != 'D') && (ss[-1] != 'V');
}
static int magisk_debug_log_filter(const char *log) {
return strstr(log, "am_proc_start") == NULL;
} }
static struct log_listener log_events[] = { static struct log_listener log_events[] = {
@ -52,10 +46,6 @@ static struct log_listener log_events[] = {
{ /* LOG_EVENT */ { /* LOG_EVENT */
.fd = -1, .fd = -1,
.filter = magisk_log_filter .filter = magisk_log_filter
},
{ /* DEBUG_EVENT */
.fd = -1,
.filter = magisk_debug_log_filter
} }
}; };
#define EVENT_NUM (sizeof(log_events) / sizeof(struct log_listener)) #define EVENT_NUM (sizeof(log_events) / sizeof(struct log_listener))
@ -114,9 +104,6 @@ void log_daemon() {
// Setup log dumps // Setup log dumps
rename(LOGFILE, LOGFILE ".bak"); rename(LOGFILE, LOGFILE ".bak");
log_events[LOG_EVENT].fd = xopen(LOGFILE, O_CREAT | O_WRONLY | O_TRUNC | O_CLOEXEC, 0644); log_events[LOG_EVENT].fd = xopen(LOGFILE, O_CREAT | O_WRONLY | O_TRUNC | O_CLOEXEC, 0644);
#ifdef MAGISK_DEBUG
log_events[DEBUG_EVENT].fd = xopen(DEBUG_LOG, O_CREAT | O_WRONLY | O_TRUNC | O_CLOEXEC, 0644);
#endif
int log_fd = -1, log_pid; int log_fd = -1, log_pid;
char line[PIPE_BUF]; char line[PIPE_BUF];

View File

@ -30,7 +30,6 @@
#define DATABIN SECURE_DIR "/magisk" #define DATABIN SECURE_DIR "/magisk"
#define MAGISKDB SECURE_DIR "/magisk.db" #define MAGISKDB SECURE_DIR "/magisk.db"
#define SIMPLEMOUNT SECURE_DIR "/magisk_simple" #define SIMPLEMOUNT SECURE_DIR "/magisk_simple"
#define DEBUG_LOG SECURE_DIR "/magisk_debug.log"
#define MANAGERAPK DATABIN "/magisk.apk" #define MANAGERAPK DATABIN "/magisk.apk"
#define MAGISKRC "/init.magisk.rc" #define MAGISKRC "/init.magisk.rc"