mirror of https://github.com/tstack/lnav.git
[line_buffer] fix crlf handling in log files
This commit is contained in:
parent
9fa3714c85
commit
2e10ca09d0
|
@ -522,6 +522,7 @@ bool line_buffer::read_line(off_t &offset, line_value &lv, bool include_delim)
|
|||
else {
|
||||
if (lv.lv_len > 1 && line_start[lv.lv_len - 1] == '\r') {
|
||||
lv.lv_len -= 1;
|
||||
offset += 1;
|
||||
}
|
||||
offset += 1; /* Skip the delimiter. */
|
||||
}
|
||||
|
|
|
@ -255,12 +255,12 @@ bool logfile::process_prefix(off_t offset, shared_buffer_ref &sbr)
|
|||
last_mod = ll.get_module_id();
|
||||
last_opid = ll.get_opid();
|
||||
}
|
||||
this->lf_index.push_back(logline(offset,
|
||||
last_time,
|
||||
last_millis,
|
||||
last_level,
|
||||
last_mod,
|
||||
last_opid));
|
||||
this->lf_index.emplace_back(offset,
|
||||
last_time,
|
||||
last_millis,
|
||||
last_level,
|
||||
last_mod,
|
||||
last_opid);
|
||||
break;
|
||||
}
|
||||
case log_format::SCAN_INCOMPLETE:
|
||||
|
|
|
@ -291,6 +291,7 @@ dist_noinst_DATA = \
|
|||
logfile_bro_conn.log.0 \
|
||||
logfile_bro_http.log.0 \
|
||||
logfile_blued.0 \
|
||||
logfile_crlf.0 \
|
||||
logfile_cxx.0 \
|
||||
logfile_empty.0 \
|
||||
logfile_epoch.0 \
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
2012-07-02 10:22:40,672:DEBUG:foo bar baz
|
||||
2014-10-08 16:56:38,344:WARN:foo bar baz
|
|
@ -360,6 +360,13 @@ check_output "rewriting machine-oriented timestamp didn't work?" <<EOF
|
|||
2015-04-10 02:58:07.456000 Goodbye, World!
|
||||
EOF
|
||||
|
||||
run_test ${lnav_test} -n -I ${test_dir} ${srcdir}/logfile_crlf.0
|
||||
|
||||
check_output "CR-LF line-endings not handled?" <<EOF
|
||||
2012-07-02 10:22:40,672:DEBUG:foo bar baz
|
||||
2014-10-08 16:56:38,344:WARN:foo bar baz
|
||||
EOF
|
||||
|
||||
# XXX get this working...
|
||||
# run_test ${lnav_test} -n -I ${test_dir} <(cat ${srcdir}/logfile_access_log.0)
|
||||
#
|
||||
|
|
Loading…
Reference in New Issue