diff --git a/src/logging.c b/src/logging.c index 6668ddff..bd434449 100644 --- a/src/logging.c +++ b/src/logging.c @@ -50,9 +50,11 @@ FILE * logfile = NULL; #include "austin.h" #include "logging.h" +int logging = 0; void _log_writer(int prio, const char * fmt, va_list ap) { + if (!logging) return; #ifdef PL_UNIX vsyslog(prio, fmt, ap); @@ -72,6 +74,8 @@ _log_writer(int prio, const char * fmt, va_list ap) { void logger_init(void) { + if (getenv("AUSTIN_NO_LOGGING") == NULL) logging = 1; + if (!logging) return; #ifdef PL_UNIX setlogmask (LOG_UPTO (LOG_DEBUG)); openlog ("austin", LOG_CONS | LOG_PID | LOG_NDELAY, LOG_LOCAL1); @@ -162,6 +166,7 @@ log_t(const char * fmt, ...) { void logger_close(void) { + if (!logging) return; #ifdef PL_UNIX closelog();