JetBrains / ideolog

Interactive viewer for '.log' files.
MIT License
252 stars 54 forks source link

Support default `loguru` format in PyCharm #130

Closed peter-gy closed 6 months ago

peter-gy commented 2 years ago

In PyCharm, it would provide an extremely nice Developer Experience to have support for the default loguru format.

Currently it looks rather unattractive:

Screenshot 2022-03-28 at 18 28 34
deployment-ian commented 1 year ago

I would also like for this to be a feature

mcarans commented 1 year ago

Yes me too

iMagist486 commented 11 months ago

loguru.zip

HenryXiaoYang commented 8 months ago

loguru.zip

Thank you so much

pawrequest commented 7 months ago

i think i must be using this wrong?

i installed loguru and it logs fine, viewing log pycharm complains unknown format, i click 'configure log formats' -> import and select the provided xml. it seems to import fine, is enabled, but pycharm still complaining and no highlighting? restarted pycharm but same

import pytest
from loguru import logger

logger.add('test.log')

@pytest.mark.asyncio
async def test_log():
    logger.info("test")

def test_re():
    import re
    with open("test.log", "r") as f:
        LOG1 = f.readline()
    pat_xml = r"^(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\.\d{3}\s)\|(\s[A-Z]*\s*)\|(\s.+:.+:\d+\s-\s.*)$"
    match = re.match(pat_xml, LOG1)

    assert match
    print("Match found!")
    print("Groups:", match.groups())

ideolog settings here tests pass so the regex is matching correctly?

ArtemKar123 commented 6 months ago

Added in #168. Will be released in the next version. Thanks for your feedback!