Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more \xxx escapes to printf implementation #7

Open
rgerhards opened this issue Feb 20, 2014 · 5 comments
Open

Add more \xxx escapes to printf implementation #7

rgerhards opened this issue Feb 20, 2014 · 5 comments

Comments

@rgerhards
Copy link
Member

We currently support a too-small subset. But before we extend it, we should think if we really want to have control characters inside our log messages (or maybe make this a config option?).

@rgerhards
Copy link
Member Author

I admit I am not even sure if it is a good idea to permit them...

@spc476
Copy link

spc476 commented Feb 25, 2014

I might support \ooo or \xhhh escapes, so that people who are using a non-ASCII character set can specify non-ASCII characters if required (not necessarily control characters).

@rgerhards
Copy link
Member Author

Thanks for the suggestion! If you'd like to contribute that code, just send me a patch or pull request. If you have no time, I'll most probably do it some time later this week.

@dabright
Copy link
Contributor

dabright commented Dec 1, 2016

I'm a little unsure what exactly this issue is trying to address. Are you talking about the backslash-escape formatting in __stdlog_sigsafe_printf()? I don't understand why that is even present. If I specify something like:

stdlog(..., "This is a message with embedded newlines specified as hex: \x0a octal: \012 and symbol: \n");

The compiler translates those escapes; __stdlog_sigsafe_printf() will never see them, so there is no need to have "support" for them in that function. In fact, I would be very surprised if I wrote:

stdlog(..., "message with literal backslash-n \\n embedded");

and found that stdlog turned that into a log message like:

message with literal backslash-n 
 embedded

I think that is what the existing code does and that section should be removed.

Am I missing something?

@rgerhards
Copy link
Member Author

IIRC the intent was to actually escape (LF) back to ('','n') so that control characters cannot render the log unreadable.

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

No branches or pull requests

3 participants