Commit 31e1be78 authored by Cedric Roux's avatar Cedric Roux

add possibility to logger 'textlog' to print full content of buffers

parent 088db3cf
......@@ -20,6 +20,8 @@ logger *new_iqlog(void *event_handler, void *database,
void framelog_set_skip(logger *_this, int skip_delay);
void framelog_set_update_only_at_sf9(logger *_this, int update_only_at_sf9);
void textlog_dump_buffer(logger *_this, int dump_buffer);
#include "view/view.h"
void logger_add_view(logger *l, view *v);
......
......@@ -32,12 +32,13 @@ struct textlog {
int fsize;
/* local output buffer */
OBUF o;
int dump_buffer;
};
static void _event(void *p, event e)
{
struct textlog *l = p;
int i;
int i, j;
#ifdef T_SEND_TIME
struct tm *t;
char tt[64];
......@@ -65,6 +66,14 @@ static void _event(void *p, event e)
case BUFFER:
PUTS(&l->o, "{buffer size:");
PUTI(&l->o, e.e[l->f[i].event_arg].bsize);
if (l->dump_buffer) {
PUTS(&l->o, " [");
for (j = 0; j < e.e[l->f[i].event_arg].bsize; j++) {
PUTX2(&l->o, ((unsigned char *)e.e[l->f[i].event_arg].b)[j]);
PUTC(&l->o, ' ');
}
PUTS(&l->o, "]");
}
PUTS(&l->o, "}");
break;
}
......@@ -196,3 +205,13 @@ error:
printf("%s:%d: bad format '%s'\n", __FILE__, __LINE__, format);
abort();
}
/****************************************************************************/
/* public functions */
/****************************************************************************/
void textlog_dump_buffer(logger *_this, int dump_buffer)
{
struct textlog *l = _this;
l->dump_buffer = dump_buffer;
}
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