Filter log messages by a numeric severity.

Log Filters

log_filter.lua
local threshold = 
local shown = 0
local labels = ""

for _, level in ipairs({1, 2, 3}) do
  if level >= threshold then
    shown = shown + 1
    labels = labels .. "L" .. level
  end
end

print("threshold=" .. threshold)
print("shown=" .. shown)
print("labels=" .. labels)
local threshold = 
local shown = 0
local labels = ""

for _, level in ipairs({1, 2, 3}) do
  if level >= threshold then
    shown = shown + 1
    labels = labels .. "L" .. level
  end
end

print("threshold=" .. threshold)
print("shown=" .. shown)
print("labels=" .. labels)
local threshold = 
local shown = 0
local labels = ""

for _, level in ipairs({1, 2, 3}) do
  if level >= threshold then
    shown = shown + 1
    labels = labels .. "L" .. level
  end
end

print("threshold=" .. threshold)
print("shown=" .. shown)
print("labels=" .. labels)
log-filter Scripts often decide which messages to show based on a threshold. This example keeps the message levels as immediate scalar values and records a compact summary.