Commit 1e533e2e authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Also force data-dumps under the new log-regime



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4500 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 85ea8cda
...@@ -120,6 +120,17 @@ static const char * const lead[] = { ...@@ -120,6 +120,17 @@ static const char * const lead[] = {
#define NLEAD (sizeof(lead)/sizeof(lead[0])) #define NLEAD (sizeof(lead)/sizeof(lead[0]))
static void
vtc_log_emit(struct vtclog *vl, unsigned lvl)
{
AZ(pthread_mutex_lock(&vtclog_mtx));
vsb_cat(vtclog_full, vsb_data(vl->vsb));
AZ(pthread_mutex_unlock(&vtclog_mtx));
if (lvl > 0 && lvl <= vtc_verbosity)
(void)fputs(vsb_data(vl->vsb), stdout);
}
//lint -e{818} //lint -e{818}
void void
vtc_log(struct vtclog *vl, unsigned lvl, const char *fmt, ...) vtc_log(struct vtclog *vl, unsigned lvl, const char *fmt, ...)
...@@ -138,12 +149,8 @@ vtc_log(struct vtclog *vl, unsigned lvl, const char *fmt, ...) ...@@ -138,12 +149,8 @@ vtc_log(struct vtclog *vl, unsigned lvl, const char *fmt, ...)
vsb_finish(vl->vsb); vsb_finish(vl->vsb);
AZ(vsb_overflowed(vl->vsb)); AZ(vsb_overflowed(vl->vsb));
AZ(pthread_mutex_lock(&vtclog_mtx)); vtc_log_emit(vl, lvl);
vsb_cat(vtclog_full, vsb_data(vl->vsb));
AZ(pthread_mutex_unlock(&vtclog_mtx));
if (lvl > 0 && lvl <= vtc_verbosity)
(void)fputs(vsb_data(vl->vsb), stdout);
vsb_clear(vl->vsb); vsb_clear(vl->vsb);
AZ(pthread_mutex_unlock(&vl->mtx)); AZ(pthread_mutex_unlock(&vl->mtx));
if (lvl == 0) { if (lvl == 0) {
...@@ -165,8 +172,7 @@ vtc_dump(struct vtclog *vl, unsigned lvl, const char *pfx, const char *str) ...@@ -165,8 +172,7 @@ vtc_dump(struct vtclog *vl, unsigned lvl, const char *pfx, const char *str)
CHECK_OBJ_NOTNULL(vl, VTCLOG_MAGIC); CHECK_OBJ_NOTNULL(vl, VTCLOG_MAGIC);
assert(lvl < NLEAD); assert(lvl < NLEAD);
if (lvl > vtc_verbosity) AZ(pthread_mutex_lock(&vl->mtx));
return;
vsb_clear(vl->vsb); vsb_clear(vl->vsb);
if (pfx == NULL) if (pfx == NULL)
pfx = ""; pfx = "";
...@@ -196,8 +202,11 @@ vtc_dump(struct vtclog *vl, unsigned lvl, const char *pfx, const char *str) ...@@ -196,8 +202,11 @@ vtc_dump(struct vtclog *vl, unsigned lvl, const char *pfx, const char *str)
vsb_printf(vl->vsb, "\n"); vsb_printf(vl->vsb, "\n");
vsb_finish(vl->vsb); vsb_finish(vl->vsb);
AZ(vsb_overflowed(vl->vsb)); AZ(vsb_overflowed(vl->vsb));
(void)fputs(vsb_data(vl->vsb), stdout);
vtc_log_emit(vl, lvl);
vsb_clear(vl->vsb); vsb_clear(vl->vsb);
AZ(pthread_mutex_unlock(&vl->mtx));
if (lvl == 0) { if (lvl == 0) {
vtc_error = 1; vtc_error = 1;
if (pthread_self() != vtc_thread) if (pthread_self() != vtc_thread)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment