Files
lush_grading/tasks/pipeline/log_parser.toml
Cormac Shannon 20e62f60f6 Reorganize task categories from opaque a/b to descriptive names
Replace category_a/category_b directories with algorithm, pipeline,
environment, filesystem, and process. Add separate mode field (solve/convert)
to decouple orchestration from capability grouping. Add per-category
summary and questionnaire breakdowns to both terminal report and HTML export.
2026-03-29 20:59:01 +01:00

35 lines
734 B
TOML

name = "log_parser"
category = "pipeline"
mode = "convert"
description = """
Read log lines from stdin. Each line has the format: "LEVEL: message"
where LEVEL is one of ERROR, WARN, INFO.
Count occurrences of each level and print a summary sorted by level name.
Format: "LEVEL: count"
"""
bash_source = """
#!/bin/bash
while IFS= read -r line || [[ -n "$line" ]]; do
echo "${line%%:*}"
done | sort | uniq -c | while read -r count level; do
echo "$level: $count"
done
"""
[[test_cases]]
stdin = """ERROR: disk full
INFO: started
WARN: low memory
ERROR: timeout
INFO: completed"""
expected_stdout = """ERROR: 2
INFO: 2
WARN: 1"""
[[test_cases]]
stdin = """INFO: boot
INFO: ready
INFO: shutdown"""
expected_stdout = "INFO: 3"