log2d icon indicating copy to clipboard operation
log2d copied to clipboard

Multi-line messages shouldn't be trimmed or split

Open PFython opened this issue 2 years ago • 3 comments

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 avatar Dec 14 '22 22:12 PFython

Fixed in pull request #17

MikeDP avatar Mar 28 '23 14:03 MikeDP

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!

PFython avatar Mar 30 '23 18:03 PFython

No worries, I'm in no hurry, I have what I need for my use.

Hope all goes well with your new venture on Monday. 👍

On Thu, 30 Mar 2023 at 19:40, Peter F @.***> wrote:

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!

— Reply to this email directly, view it on GitHub https://github.com/PFython/log2d/issues/15#issuecomment-1490755584, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALF2JVKC56JLQ6ADEYRU2TW6XHRDANCNFSM6AAAAAAS67WYCA . You are receiving this because you commented.Message ID: @.***>

MikeDP avatar Mar 31 '23 08:03 MikeDP