[logline] fix the read of the template line in get_columns and add man page

This commit is contained in:
Timothy Stack 2013-08-20 18:41:15 -07:00
parent 83f94cea86
commit ba5b89ffe9
2 changed files with 98 additions and 3 deletions

96
lnav.1 Normal file
View File

@ -0,0 +1,96 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.43.3.
.\" Some roff macros, for reference:
.\" .nh disable hyphenation
.\" .hy enable hyphenation
.\" .ad l left justify
.\" .ad b justify to both left and right margins
.\" .nf disable filling
.\" .fi enable filling
.\" .br insert line break
.\" .sp <n> insert n+1 empty lines
.\" for manpage-specific macros, see man(7)
.\" Define macros
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.TH LNAV "1" "August 2013"
.SH NAME
lnav \- ncurses-based log file viewer
.SH SYNOPSIS
.B lnav
[\-hVsar] [logfile1 logfile2 ...]
.SH DESCRIPTION
The log file navigator, lnav, is an enhanced log file viewer that
takes advantage of any semantic information that can be gleaned from
the files being viewed, such as timestamps and log levels. Using this
extra semantic information, lnav can do things like interleaving
messages from different files, generate histograms of messages over
time, and providing hotkeys for navigating through the file. It is
hoped that these features will allow the user to quickly and
efficiently zero in on problems.
.SH KEY BINDINGS
.TP
?
View/leave the online help text.
.TP
q
Quit the program.
.SH OPTIONS
.TP
\fB\-h\fR
Print help and exit
.TP
\fB\-d\fR file
Write debug messages to the given file.
.TP
\fB\-V\fR
Print version information.
.TP
\fB\-s\fR
Load the most recent syslog messages file.
.TP
\fB\-a\fR
Load all of the most recent log file types.
.TP
\fB\-r\fR
Load older rotated log files as well.
.TP
\fB\-t\fR
Prepend timestamps to the lines of data being read in
on the standard input.
.TP
\fB\-w\fR file
Write the contents of the standard input to this file.
.SS "Optional arguments:"
.TP
logfile1
The log files or directories to view. If a
directory is given, all of the files in the
directory will be loaded.
.SH EXAMPLES
To load and follow the syslog file:
.PP
.Vb 1
\& lnav \-s
.Ve
.PP
To load all of the files in /var/log:
.PP
.Vb 1
\& lnav /var/log
.Ve
.PP
To watch the output of make with timestamps prepended:
.PP
.Vb 1
\& make 2>&1 | lnav \-t
.Ve
.SH AUTHOR
This manual page was written by Salvatore Bonaccorso <carnil@debian.org>
for the Debian system (but may be used by others).

View File

@ -62,8 +62,7 @@ public:
content_line_t cl_copy = this->ldt_template_line;
logfile * lf = lnav_data.ld_log_source.find(
cl_copy);
std::string val = lf->read_line(
lf->begin() + cl_copy);
std::string val;
struct line_range body;
string_attrs_t sa;
std::vector<logline_value> line_values;
@ -72,7 +71,7 @@ public:
if (this->ldt_format_impl != NULL) {
this->ldt_format_impl->get_columns(cols);
}
lf->read_full_message(lf->begin(), val);
lf->read_full_message(lf->begin() + cl_copy, val);
format->annotate(val, sa, line_values);
body = find_string_attr_range(sa, "body");
if (body.lr_end == -1 || body.length() == 0) {