[log format] generic prefix len

pull/69/head
Timothy Stack 11 years ago
parent 5a7d6dab2c
commit df80972d5d

@ -244,6 +244,7 @@ char *log_format::log_scanf(const char *line,
this->lf_fmt_lock = curr_fmt;
this->lf_time_fmt_lock = curr_time_fmt;
this->lf_time_fmt_len = retval - time_dest;
found = true;
break;

@ -276,13 +276,15 @@ public:
};
};
log_format() : lf_fmt_lock(-1), lf_time_fmt_lock(-1) { };
log_format() : lf_fmt_lock(-1), lf_time_fmt_lock(-1), lf_time_fmt_len(-1) {
};
virtual ~log_format() { };
virtual void clear(void)
{
this->lf_fmt_lock = -1;
this->lf_time_fmt_lock = -1;
this->lf_time_fmt_len = -1;
};
/**
@ -337,6 +339,7 @@ protected:
int lf_fmt_lock;
int lf_time_fmt_lock;
int lf_time_fmt_len;
};
/**

@ -571,7 +571,7 @@ class generic_log_format : public log_format {
sscanf(line.c_str(), fmt, timestr, level, &prefix_len);
lr.lr_start = fmt[0] == '%' ? 0 : 1;
lr.lr_end = lr.lr_start + strlen(timestr);
lr.lr_end = lr.lr_start + this->lf_time_fmt_len;
sa[lr].insert(make_string_attr("timestamp", 0));
for (int lpc = 0; level[lpc]; lpc++) {
@ -583,7 +583,7 @@ class generic_log_format : public log_format {
}
if (logline::string2level(level, true) == logline::LEVEL_UNKNOWN) {
prefix_len = strlen(timestr);
prefix_len = lr.lr_end;
}
lr.lr_start = 0;

Loading…
Cancel
Save