python(): LogTemplate::format() now returns a bytes object#799
Merged
bazsi merged 2 commits intoaxoflow:mainfrom Sep 20, 2025
Merged
python(): LogTemplate::format() now returns a bytes object#799bazsi merged 2 commits intoaxoflow:mainfrom
python(): LogTemplate::format() now returns a bytes object#799bazsi merged 2 commits intoaxoflow:mainfrom
Conversation
MrAnno
added a commit
to MrAnno/axosyslog
that referenced
this pull request
Sep 19, 2025
Signed-off-by: László Várady <[email protected]>
100f4e5 to
fd51f01
Compare
MrAnno
added a commit
to MrAnno/axosyslog
that referenced
this pull request
Sep 19, 2025
Signed-off-by: László Várady <[email protected]>
fd51f01 to
70d32f6
Compare
Unfortunately, LogMessage is not UTF-8 or Unicode-safe by default.
This property is inherited by the LogTemplate class as well because it
operates on LogMessage fields.
This is a breaking change. When using templates, you should call
`format().decode("utf-8", errors="backslashreplace")` or anything similar
to get a Python string.
Signed-off-by: László Várady <[email protected]>
Signed-off-by: László Várady <[email protected]>
70d32f6 to
5a27225
Compare
bazsi
approved these changes
Sep 20, 2025
Member
bazsi
left a comment
There was a problem hiding this comment.
LogTemplate().format() returning bytes makes a lot of sense. This is the only use of LogTemplate that is shipped with AxoSyslog itself. I did not test the code, but the change looks good to me.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the Python bindings,
LogMessageis not UTF-8 or Unicode–safe by default.This means developers must explicitly call
decode()on message fields and handle any decoding errors themselves.Since
LogTemplateoperates onLogMessagefields, this behavior also applies to it.Breaking change:
When using templates, you now need to decode the result manually. For example:
format().decode("utf-8", errors="backslashreplace")Conflicts with #797.