Skip to content

feat(stdlib): add add_syslog_level processor#829

Open
Solaris-star wants to merge 2 commits into
hynek:mainfrom
Solaris-star:feat/249-add-syslog-level
Open

feat(stdlib): add add_syslog_level processor#829
Solaris-star wants to merge 2 commits into
hynek:mainfrom
Solaris-star:feat/249-add-syslog-level

Conversation

@Solaris-star

Copy link
Copy Markdown

Description

Adds structlog.stdlib.add_syslog_level, a processor that writes the syslog severity (0–7) into the event dict as syslog_level.

This is the first half of #249 (mapping). It helps when:

  • feeding stdout/stderr to systemd with SyslogLevelPrefix=yes
  • building processors that call the stdlib syslog module

Mapping follows logging.handlers.SysLogHandler / syslog(3):

method priority
critical 2
error / exception 3
warn / warning 4
info 6
debug / notset 7

Tests

pytest tests/test_stdlib.py::TestAddSyslogLevel tests/test_stdlib.py::TestAddLogLevelNumber -q
# 16 passed

Linked Issue

Closes #249

Solaris-star and others added 2 commits July 21, 2026 13:29
Add a processor that attaches syslog severity (0-7) as syslog_level,
mirroring SysLogHandler / syslog(3). Useful for systemd
SyslogLevelPrefix and plain syslog integrations.

Fixes hynek#249
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a helper function for systemd's SyslogLevelPrefix

1 participant