PySnooper icon indicating copy to clipboard operation
PySnooper copied to clipboard

Log highlighting format with IntelliJ/Pycharm ideolog

Open pjpjq opened this issue 6 years ago • 10 comments

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?

pjpjq avatar May 04 '19 03:05 pjpjq

@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}

AtHeartEngineer avatar May 10 '19 01:05 AtHeartEngineer

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

image

In addition , pycharm poor support for large files.

625781186 avatar Jul 15 '19 14:07 625781186

@625781186 that's snoop, not PySnooper.

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

alexmojaki avatar Jul 15 '19 14:07 alexmojaki

Haha, yeah.

On Mon, Jul 15, 2019, 17:47 Alex Hall [email protected] 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 .

cool-RR avatar Jul 15 '19 14:07 cool-RR

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

625781186 avatar Jul 15 '19 16:07 625781186

@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.

alexmojaki avatar Jul 15 '19 16:07 alexmojaki

@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.

625781186 avatar Jul 19 '19 10:07 625781186

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

cool-RR avatar Jul 19 '19 10:07 cool-RR

@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

625781186 avatar Jul 19 '19 10:07 625781186

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

cool-RR avatar Jul 19 '19 11:07 cool-RR