cool-RR / PySnooper

Never use print for debugging again
MIT License
16.4k stars 955 forks source link

Log highlighting format with IntelliJ/Pycharm ideolog #93

Open pjpjq opened 5 years ago

pjpjq commented 5 years ago

image I saved the log into a .log file. IntelliJ ideolog suggests "log format not recognized" and need to configure log format pattern for better highlighting. Is it possible to make it highlighted better in IntelliJ/Pycharm with ideolog plugin?

AtHeartEngineer commented 5 years ago

@wendingp I have been messing around with this for the last 30 minutes trying to get something to work. It doesn't work yet, but if anyone wants to help, that would be super cool. I've double checked it at regexr.com and it...should be working, but doesn't.

Message Pattern:^(\d{2}:\d{2}:\d{2}.\d{6})\s+(\w+)\s+(\d+)\s+(.*)$ I've tried ^(?m) at the beginning also to enable multi-line mode...but that doesn't do anything.

Message Start Pattern: ^\d

Time Format: I've tried HH:mm:ss.SSS and HH:mm:ss.SSSSSS and ^\d{2}:\d{2}:\d{2}.\d{6}

625781186 commented 5 years ago

@wendingp I use vscode . Need install plugin log file highlighter. image

image

In addition , pycharm poor support for large files.

alexmojaki commented 5 years ago

@625781186 that's snoop, not PySnooper.

@cool-RR wow I guess the potential for confusion is worse than I thought...

cool-RR commented 5 years ago

Haha, yeah.

On Mon, Jul 15, 2019, 17:47 Alex Hall notifications@github.com wrote:

@625781186 https://github.com/625781186 that's snoop https://github.com/alexmojaki/snoop, not PySnooper.

@cool-RR https://github.com/cool-RR wow I guess the potential for confusion is worse than I thought...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cool-RR/PySnooper/issues/93?email_source=notifications&email_token=AAAN3SUDHETLOZNARYZN4TLP7SEYZA5CNFSM4HKX6XV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ55X7I#issuecomment-511433725, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAN3SSUDERBSLFAE23NETTP7SEYZANCNFSM4HKX6XVQ .

625781186 commented 5 years ago

@alexmojaki Haha, I know I use snoop , but I just talk about a better method to read .log file.

alexmojaki commented 5 years ago

@625781186 what I mean is that there's no >>> Call to or <<< Return value in PySnooper, it's only in snoop.

In any case for snoop it might be better to use the provided coloring which includes syntax highlighting. If you just output to the default stderr it should work, but if you want to use a file you can force color with snoop.install(color=True) and then view the file with a tool that supports ANSI escape codes (unfortunately vscode-logfile-highlighter doesn't right now), such as the less command in a Unix terminal.

625781186 commented 5 years ago

@625781186 what I mean is that there's no >>> Call to or <<< Return value in PySnooper, it's only in snoop.

In any case for snoop it might be better to use the provided coloring which includes syntax highlighting. If you just output to the default stderr it should work, but if you want to use a file you can force color with snoop.install(color=True) and then view the file with a tool that supports ANSI escape codes (unfortunately vscode-logfile-highlighter doesn't right now), such as the less command in a Unix terminal.

@cool-RR

Hello , How do I fold code in markdown like you ? Thank you.

cool-RR commented 5 years ago

I think it's automatic because I made a comment by replying on GMail to GitHub's notification.

625781186 commented 5 years ago

@cool-RR

Can you copy the source code of https://github.com/cool-RR/PySnooper/issues/93#issuecomment-511436040 for me to see? I'm really curious.

image

cool-RR commented 5 years ago

Sure, here's the source: https://gist.github.com/cool-RR/182953dee1f726a9689968bb0ae52778