static int debug = (LOG_LEVEL_FATAL | LOG_LEVEL_ERROR);
/* static functions */
-static void fatal_error(const char * error_message);
+static void fatal_error(const char *error_message);
#ifdef _WIN32
static char *w32_socket_strerr(int errcode, char *tmp_buf);
#endif
#ifdef MUTEX_LOCKS_AVAILABLE
-static inline void lock_logfile(void)
+static void lock_logfile(void)
{
privoxy_mutex_lock(&log_mutex);
}
-static inline void unlock_logfile(void)
+static void unlock_logfile(void)
{
privoxy_mutex_unlock(&log_mutex);
}
-static inline void lock_loginit(void)
+static void lock_loginit(void)
{
privoxy_mutex_lock(&log_init_mutex);
}
-static inline void unlock_loginit(void)
+static void unlock_loginit(void)
{
privoxy_mutex_unlock(&log_init_mutex);
}
* The locking/unlocking functions below should be
* fleshed out for non-pthread implementations.
*/
-static inline void lock_logfile() {}
-static inline void unlock_logfile() {}
-static inline void lock_loginit() {}
-static inline void unlock_loginit() {}
+static void lock_logfile() {}
+static void unlock_logfile() {}
+static void lock_loginit() {}
+static void unlock_loginit() {}
#endif
/*********************************************************************
* Returns : Number of written characters or 0 for error.
*
*********************************************************************/
-static inline size_t get_log_timestamp(char *buffer, size_t buffer_size)
+static size_t get_log_timestamp(char *buffer, size_t buffer_size)
{
size_t length;
time_t now;
* Returns : Number of written characters or 0 for error.
*
*********************************************************************/
-static inline size_t get_clf_timestamp(char *buffer, size_t buffer_size)
+static size_t get_clf_timestamp(char *buffer, size_t buffer_size)
{
/*
* Complex because not all OSs have tm_gmtoff or
* Returns : Log level string.
*
*********************************************************************/
-static inline const char *get_log_level_string(int loglevel)
+static const char *get_log_level_string(int loglevel)
{
char *log_level_string = NULL;
case LOG_LEVEL_CONNECT:
log_level_string = "Connect";
break;
+ case LOG_LEVEL_TAGGING:
+ log_level_string = "Tagging";
+ break;
case LOG_LEVEL_WRITING:
log_level_string = "Writing";
break;
char outbuf[LOG_BUFFER_SIZE+1];
char tempbuf[LOG_BUFFER_SIZE];
size_t length = 0;
- const char * src = fmt;
+ const char *src = fmt;
long thread_id;
char timestamp[30];
const size_t log_buffer_size = LOG_BUFFER_SIZE;
#if defined(_WIN32) && !defined(_WIN_CONSOLE)
/*
- * Irrespective of debug setting, a GET/POST/CONNECT makes
- * the taskbar icon animate. (There is an option to disable
- * this but checking that is handled inside LogShowActivity()).
+ * Irrespective of debug setting, a request makes the taskbar icon
+ * animate. (There is an option to disable this but checking that is
+ * handled inside LogShowActivity()).
*/
- if ((loglevel == LOG_LEVEL_REQUEST) || (loglevel == LOG_LEVEL_CRUNCH))
+ if (loglevel == LOG_LEVEL_REQUEST)
{
LogShowActivity();
}
#ifdef FUZZ
if (debug == LOG_LEVEL_STFU)
{
+ if (loglevel == LOG_LEVEL_FATAL)
+ {
+ exit(1);
+ }
return;
}
#endif
if (loglevel == LOG_LEVEL_FATAL)
{
- fatal_error("Fatal error. You're not supposed to"
- "see this message. Please file a bug report.");
+ fatal_error("Fatal error. You're not supposed to "
+ "see this message. Please file a bug report.\n");
}
return;
}
int ret = snprintf(outbuf + length,
log_buffer_size - length - 2, "\\x%.2x", (unsigned char)*sval);
assert(ret == 4);
- length += 4;
+ if (ret == 4)
+ {
+ length += 4;
+ }
}
sval++;
}