diff options
Diffstat (limited to 'filters/terraria.py')
| -rw-r--r-- | filters/terraria.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/filters/terraria.py b/filters/terraria.py new file mode 100644 index 0000000..93b5d91 --- /dev/null +++ b/filters/terraria.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +""" +Terraria log filter for Umbrella (vanilla, tModLoader) + +Vanilla and tModLoader produce fairly clean output, so this filter +mostly just strips blank lines and tModLoader's internal loading/debug +noise during startup. + +Vanilla format: plain text, e.g. ": <Player> has joined." +tModLoader format varies; startup emits many mod loading lines. + +Install: /usr/lib/umbrella/filters/terraria.py +Unit YAML: log_filter: /usr/lib/umbrella/filters/terraria.py +""" + +import sys +import re + +SKIP = re.compile( + r'^\s*$' # blank lines + r'|^: $' # bare colon lines (vanilla idle) + r'|\[tML\].*Loading mod' # tModLoader mod loading spam + r'|\[tML\].*Unloading mod' + r'|\[tML\].*Reloading mods' + r'|Received mods from' # mod sync noise in multiplayer + r'|Joining world\.\.\.' +) + +for line in sys.stdin: + if SKIP.search(line): + continue + sys.stdout.write(line) + sys.stdout.flush() |
