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

Multi-line messages shouldn't be trimmed or split #15

Open
PFython opened this issue Dec 14, 2022 · 3 comments
Open

Multi-line messages shouldn't be trimmed or split #15

PFython opened this issue Dec 14, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@PFython
Copy link
Owner

PFython commented Dec 14, 2022

I noticed that

a) leading tabs \t are removed from multi-line messages (and possibly single line - not tested)
b) multi-line messages are split by new line \n but I think the results should be one item in the results list per message, not per line. In other words the text string of each log message should not be altered by the .find method. If people want to strip out whitespace after receiving the original string then that's up to them, but I think we need to give them the option because sometimes the newline formatting will be important.

Here's the test I think we need to pass, which I've added to test_log2d.py:

@create_mylog
def test_find_multiline():
    Log.mylog.info("Three line message\n\twith more data on this line\n\t\tand also on this line too!")
    r = mylog.find()
    assert len(r) == 2
    assert r.count("\t") == 3
    assert r.count("\n") == 2
@PFython PFython added the bug Something isn't working label Dec 14, 2022
@PFython PFython changed the title Multi-line messages are (unhelpfully) trimmed and split Multi-line messages shouldn't be trimmed or split Dec 14, 2022
@MikeDP
Copy link
Contributor

MikeDP commented Mar 28, 2023

Fixed in pull request #17

@PFython
Copy link
Owner Author

PFython commented Mar 30, 2023

Mike thanks so much and sorry for my slow responses... I'm launch a new business on Monday so likely to be fully focussed on that soon, but have seen your recent updates and look forward to rereading properly when the dust settles. Thanks for your patience and all your contributions!

@MikeDP
Copy link
Contributor

MikeDP commented Mar 31, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants