Compare commits

..

No commits in common. "5ebfe7d07b187867b3dba4765f783a4af926a8d3" and "72bffca489ec38ca3de1fe580bccb4d87212e1fe" have entirely different histories.

2 changed files with 5 additions and 33 deletions

View File

@ -1,33 +0,0 @@
# 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 <path to lua> <path to logfile>
```
### 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
```

View File

@ -10,6 +10,11 @@
#define EXIT_LOGFILE_HANDLING 2
#define EXIT_LUAFILE_HANDLING 3
// // TODO: assign to lua
// #define COLOR_RED 1
// #define COLOR_BLUE 2
// #define COLOR_GREEN 3
void trim(char *string) {
if (strlen(string) > 0 && string[strlen(string) - 1] == '\n') {
string[strlen(string) - 1] = '\0';