diff --git a/README.md b/README.md new file mode 100644 index 0000000..2269598 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# LOGFOO +Filter and format logfiles on command line + +## build +* LUA required ;) +``` +gcc -I/usr/include/lua5.4 -g logfoo.c -llua5.4 -o logfoo +``` + +## usage +``` +logfoo +``` +### lua +* the lua needs 2 methods + * `function filter (line)` returns boolean; true -> don't print line + * `function format (line)` returns string +* example: +```lua +function filter (line) + -- only lines containing text "Unknown kernel..." + return line:find("Unknown kernel command line parameters") == nil +end + +function format (line) + -- red, bold, underline text "IMAGE" + line = line:gsub("(IMAGE)", color("%1", "31;1;4")) + -- green text "gentoo" + line = line:gsub("(gentoo)", color("%1", "32")) + -- only text between " + return line:match("\"([^\"]+)\"") +end +``` \ No newline at end of file