Merge branch 'master' of github.com:tstack/lnav

pull/37/merge
Tim Stack 13 years ago
commit 4f0d28be3f

@ -40,12 +40,10 @@ generic log files with timestamps.
DISPLAY
-------
The main part of the display shows the log lines from the files
interleaved based on time-of-day. The lines are "scrubbed" to remove
redundant/extraneous parts and highlighted to emphasize other parts.
New lines are automatically loaded as they are appended to the files
and, if you are viewing the bottom of the files, lnav will scroll down
to display the new lines, much like 'tail -f'.
The main part of the display shows the log lines from the files interleaved
based on time-of-day. New lines are automatically loaded as they are appended
to the files and, if you are viewing the bottom of the files, lnav will scroll
down to display the new lines, much like 'tail -f'.
On color displays, the lines will be highlighted as follows:
@ -72,7 +70,18 @@ Above and below the main body are status lines that display:
Finally, the last line on the display is where you can enter search
patterns and execute internal commands, such as converting a
unix-timestamp into a human-readable date.
unix-timestamp into a human-readable date. The command-line is by
the readline library, so the usual set of keyboard shortcuts can
be used.
The body of the display is also used to display other content, such
as: the help file, histograms of the log messages over time, and
SQL results. The views are organized into a stack so that any time
you activate a new view with a key press or command, the new view
is pushed onto the stack. Pressing the same key again will pop the
view off of the stack and return you to the previous view. Note
that you can always use 'q' to pop the top view off of the stack.
KEY BINDINGS
@ -83,7 +92,8 @@ make it easy to zero-in on a specific section of the file or scan
through the file.
? View/leave this help message.
q Quit.
q Leave the current view or quit the program when in
the log file view.
home Move to the top of the file.
end Move to the end of the file.
@ -98,7 +108,7 @@ through the file.
w/W Move to the next/previous warning.
n/N Move to the next/previous search hit.
f/F Move to the next/previous file. In the log view, this
moves to the next line from a different file. In the
moves to the next line from a different file. In the
text view, this rotates the view to the next file.
>/< Move horizontally to the next/previous search hit.
@ -126,14 +136,14 @@ through the file.
the 'u' hotkey to iterate through marks you have
added.
M Mark/unmark all the lines between the top of the
M Mark/unmark all the lines between the top of the
display and the last line marked/unmarked.
J Mark/unmark the next line after the previously
marked line.
marked line.
K Like 'J' except it toggles the mark on the
previous line.
K Like 'J' except it toggles the mark on the
previous line.
c Copy the marked text to the X selection buffer.
@ -196,7 +206,7 @@ through the file.
v Switch to/from the SQL result view.
V Switch between the log and SQL result views while
keeping the top line number in the log view in
keeping the top line number in the log view in
sync with the line_number column in the SQL view.
For example, doing a query that selects for
"idle_msecs" and "line_number", you can move the

@ -2008,6 +2008,8 @@ static void rl_callback(void *dummy, readline_curses *rc)
lnav_data.ld_mode = LNM_PAGING;
break;
}
curs_set(0);
}
static void usage(void)
@ -2243,6 +2245,8 @@ static void looper(void)
rlc.set_perform_action(readline_curses::action(rl_callback));
rlc.set_timeout_action(readline_curses::action(rl_search));
(void)curs_set(0);
lnav_data.ld_view_stack.push(&lnav_data.ld_views[LNV_LOG]);
tc = lnav_data.ld_view_stack.top();
@ -2343,9 +2347,6 @@ static void looper(void)
&ready_rfds, NULL, NULL,
&to);
lnav_data.ld_bottom_source.
update_hits(lnav_data.ld_view_stack.top());
if (rc < 0) {
switch (errno) {
case EINTR:
@ -2418,6 +2419,11 @@ static void looper(void)
if (gc.get() != NULL) {
gc->get_grep_proc()->check_fd_set(ready_rfds);
if (!lnav_data.ld_view_stack.empty()) {
lnav_data.ld_bottom_source.
update_hits(lnav_data.ld_view_stack.top());
}
}
}
rlc.check_fd_set(ready_rfds);
@ -2851,19 +2857,19 @@ int main(int argc, char *argv[])
DEFAULT_FILES.insert(make_pair(LNF_SYSLOG, string("var/log/system.log")));
DEFAULT_FILES.insert(make_pair(LNF_SYSLOG, string("var/log/syslog")));
lnav_commands["unix-time"] = com_unix_time;
lnav_commands["current-time"] = com_current_time;
lnav_commands["goto"] = com_goto;
lnav_commands["graph"] = com_graph;
lnav_commands["highlight"] = com_highlight;
lnav_commands["filter-in"] = com_filter;
lnav_commands["filter-out"] = com_filter;
lnav_commands["append-to"] = com_save_to;
lnav_commands["write-to"] = com_save_to;
lnav_commands["enable-filter"] = com_enable_filter;
lnav_commands["disable-filter"] = com_disable_filter;
lnav_commands["capture-into"] = com_capture;
lnav_commands["session"] = com_session;
lnav_commands["unix-time"] = com_unix_time;
lnav_commands["current-time"] = com_current_time;
lnav_commands["goto"] = com_goto;
lnav_commands["graph"] = com_graph;
lnav_commands["highlight"] = com_highlight;
lnav_commands["filter-in"] = com_filter;
lnav_commands["filter-out"] = com_filter;
lnav_commands["append-to"] = com_save_to;
lnav_commands["write-to"] = com_save_to;
lnav_commands["enable-filter"] = com_enable_filter;
lnav_commands["disable-filter"] = com_disable_filter;
lnav_commands["capture-into"] = com_capture;
lnav_commands["session"] = com_session;
lnav_data.ld_views[LNV_HELP].
set_sub_source(new plain_text_source(help_text_start));

@ -524,6 +524,8 @@ void readline_curses::focus(int context, const char *prompt)
{
char buffer[1024];
curs_set(1);
this->rc_active_context = context;
snprintf(buffer, sizeof(buffer), "f:%d:%s", context, prompt);

@ -94,9 +94,10 @@ public:
};
void update_filename(listview_curses *lc) {
status_field &sf_format = this->tss_fields[TSF_FORMAT];
status_field &sf_filename = this->tss_fields[TSF_FILENAME];
if (lc->get_inner_height() > 0) {
status_field &sf_format = this->tss_fields[TSF_FORMAT];
status_field &sf_filename = this->tss_fields[TSF_FILENAME];
struct line_range lr = { 0, -1 };
attrs_map_t::iterator iter;
string_attrs_t sa;
@ -110,17 +111,23 @@ public:
logfile *lf = (logfile *)iter->second.sa_ptr;
if (lf->get_format())
sf_format.set_value("(%s)",
lf->get_format()->get_name().c_str());
sf_format.set_value("(%s)",
lf->get_format()->get_name().c_str());
else if (!lf->get_filename().empty())
sf_format.set_value("(unknown)");
else
sf_format.set_value("(unknown)");
sf_format.clear();
sf_filename.set_value(lf->get_filename());
}
else {
sf_format.set_value("(unknown)");
sf_format.clear();
sf_filename.clear();
}
}
else {
sf_format.clear();
sf_filename.clear();
}
};
private:

Loading…
Cancel
Save