Replace newline `\n` with literal `\\n` in log
See original GitHub issueI’d love the option to force log messages to span just one line by replacing \n
with \\n
.
This is an issue which are sometimes encountered when logging Pandas DataFrames and Numpy Arrays.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Replace newlines with literal \n - Stack Overflow
This works, but not for special characters like \r, \n, etc. What I'm trying to do is to replace the newline character by...
Read more >sed - How can I replace a newline with its escape sequence?
varName - Name of the variable containing the content; // - Replace all instances of... $'\n' - The literal newline character (we're turning...
Read more >Vim - How to replace a newline with the string "\n"
start an ex command 1,$-1 over a range from the first line till the last but one s/ substitute \n all newlines /...
Read more >JavaScript Program to Replace All Line Breaks with <br>
The RegEx is used with the replace() method to replace all the line breaks in string with <br>. The pattern /(\r\n|\r|\n)/ checks for...
Read more >Find and replace can no longer replace with newline ('\n') #5657
Open find and replace (CTRL+H) · Search for any text (e.g. " ") · Set replacement text to include '\n' (e.g. "\n") image...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yep, that’s totally possible. Instead of modifying
record["message"]
, just create a new entry to be used by theformat
parameter of some specific sinks only.Oh, yeah, sorry, I completely misinterpreted your question.
So, here is another workaround I can offer you. 😄
I think you can use
patch()
to force themessage
to span only one line. You can also apply the change for your whole application by using thepatcher
parameter of theconfigure()
method.