Read misc.loglevel from RFC 5424 and POSIX <syslog.h> #28
@@ -1237,7 +1237,7 @@ the Development section below, and who ships a register the four above then draw
|
||||
- **`misc.loglevel` is a table keyed by the code, rendering POSIX's keyword.** A flat
|
||||
list of names carries neither the code a PRI encodes nor a selector reaching it, and
|
||||
goal 1 draws the two as one fact. RFC 5424 spells the severity `Informational`,
|
||||
which no syslog, PSR-3 or `slog` checker accepts, so the shipped spelling is the one
|
||||
which no syslog checker accepts, so the shipped spelling is the one
|
||||
a configuration writes, `info`, and the RFC's name stays the `severity` column. The
|
||||
code and the keyword take the two selector slots, so `misc.loglevel[Error]` misses.
|
||||
- **`misc.tld` keys carry the leading dot, where other tables key on a bare code.**
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
Table 2 is the whole set, read between the facility table's caption and its own. The
|
||||
keyword is POSIX's severity macro less its `LOG_` prefix, lowercased, taken in the
|
||||
order POSIX lists them, which `LOG_UPTO` states is the severity order; each must be a
|
||||
prefix of the severity RFC 5424 numbers alike, so the two sources pin one pairing.
|
||||
order POSIX lists them; each must be a prefix of the severity RFC 5424 numbers alike,
|
||||
so the two sources pin one pairing.
|
||||
"""
|
||||
import argparse
|
||||
import html
|
||||
@@ -24,7 +24,7 @@ CACHE = Path(__file__).resolve().parent / "cache"
|
||||
COLUMNS = ["code", "keyword", "severity"]
|
||||
TABLE = re.compile(r"Table 1\.\s+Syslog Message Facilities(.*?)Table 2\.\s+Syslog Message Severities", re.S)
|
||||
ROW = re.compile(r"^ +(\d) +([A-Z][a-z]+): ", re.M)
|
||||
SEVERITIES = re.compile(r"severity level portion of the.*?macros:(.*?)The following shall be declared as functions", re.S)
|
||||
SECTION = re.compile(r"severity level portion of the.*?macros:(.*?)The following shall be declared as functions", re.S)
|
||||
MACRO = re.compile(r"\bLOG_([A-Z]+)\b")
|
||||
EXPECTED = 8
|
||||
|
||||
@@ -37,7 +37,7 @@ def severities(text):
|
||||
|
||||
|
||||
def keywords(page):
|
||||
section = SEVERITIES.search(html.unescape(re.sub(r"<[^>]+>", "", page)))
|
||||
section = SECTION.search(html.unescape(re.sub(r"<[^>]+>", "", page)))
|
||||
if not section:
|
||||
sys.exit("POSIX spells no severity list between its own caption and the function declarations; the page has moved")
|
||||
return [m.lower() for m in MACRO.findall(section.group(1))]
|
||||
|
||||
@@ -110,8 +110,9 @@ by a `data-import/` script, as README goal 10 asks.
|
||||
`misc.httpmethod[get]` and `misc.territory[se]` all answer "no row … has key or name"
|
||||
and stop there, where a case-insensitive match could name the row that exists, and a
|
||||
table with no `name` column could say it selects by key alone. `misc.tld[se]` misses
|
||||
on the leading dot its keys carry rather than on case, so the near miss is worth
|
||||
naming whatever shape it takes.
|
||||
on the leading dot its keys carry rather than on case, and `misc.loglevel[Error]`
|
||||
although the table carries `Error` in a column, so the near miss is worth naming
|
||||
whatever shape it takes.
|
||||
- Let a table column carry a `datatype`, so `--format json` writes
|
||||
`"safe": true` and `--format sql` a boolean rather than the text `'true'`. Today only
|
||||
a JSON field takes one, so `misc.httpmethod`'s booleans are typed in Go and text
|
||||
|
||||
Reference in New Issue
Block a user