vscode-logfile-highlighter icon indicating copy to clipboard operation
vscode-logfile-highlighter copied to clipboard

Assign custom highlighting patterns to predefined log items

Open bobatsar opened this issue 4 years ago • 4 comments

Is there a way to use the custom highlighting patterns and attach them to the predefined log items?

e.g.:

"logFileHighlighter.customPatterns": [
    {
        "pattern": "E/\\w+",
        "scope": "log.error"
    },
    {
        "pattern": "Q/\\w+",
        "scope": "log.warning"
    },
]

bobatsar avatar Nov 30 '20 08:11 bobatsar

No, I'm afraid not. Nice idea, but with the current implementation I think it would be hard to implement.

emilast avatar Dec 06 '20 14:12 emilast

Just chiming in to say I'd also love if this were possible in the future! I currently have custom patterns for ESP32 log highlighting but this only works with certain themes.

"logFileHighlighter.customPatterns": [
        {
            // comments (//)
            "pattern": "[^:]//.*",
            "foreground": "#a0abbd"
        },
        {
            // info 
            "pattern": "^I [()0-9.:]+",
            "foreground": "#13a10e"
        },
        {
            // warning
            "pattern": "^W [()0-9.:]+",
            "foreground": "#c19c00"
        },
        {
            // error 
            "pattern": "^E [()0-9.:]+",
            "foreground": "#c50f1f"
        },
        {
            // debug or verbose
            "pattern": "^[DV] [()0-9.:]+",
            "foreground": "#8c8be0"
        },
    ],

Ideally I would be able to replace the hex codes with something like terminal.ansiGreen etc. to grab a suitably readable colour that matches the theme.

If that's still difficult to implement would you consider adding (or allowing a PR with) specific support for ESP32 style logs @emilast? I'll open a separate issue if you're interested :)

mianowill avatar Jun 28 '22 16:06 mianowill

@mianowill, I'm going though old issues and just saw your comment which I apparently missed before. Sorry for that. Please create a separate issue for the ESP32 log file style and supply an example and I'll see what I can do, if that would still be useful for you.

emilast avatar Nov 15 '23 20:11 emilast

@emilast totally forgot about this. Will do, ty!

mianowill avatar Nov 15 '23 21:11 mianowill