My first user defined language

  • I have a log file that I’d like to create a UDL to highlight the text based on keywords. Before I start on it I’d just like to know if it’s possible. It’s not really a language.

    For example, my log file might look like:

    6/22/2021 3:47 Keylogger Start key pressed
    6/22/2021 3:47 Keylogger Start key released
    6/22/2021 3:49 AlarmLog Battery alarm
    6/22/2021 3:49 AlarmLog Battery alarm reset
    6/22/2021 4:50 EventLog Settings changed

    Say I’d like to have any lines with KeyLogger be light blue text on a black background, AlarmLog Red text on black, and EventLog Black on white. Could I do this with a UDL?


  • @John-Davies ,

    The whole line? No. But using “delimiters” instead of keywords, you can highlight from the key (Keylogger, AlarmLog, or EventLog) to the end of the line:


    If that’s not good enough, you can add extra highlighting to a lexer (including UDL lexer) using regexes via the script that @Ekopalypse shares in his github repo .

    Also, there is a plugin called the “AnalysePlugin”, which claims “AnalysePlugin will help you to search for more than one search pattern at a time. Great for analysing big log files…” – you can use the Plugins menu Plugins Admin to install that plugin, and see if it works for you.

  • Thank you. That’s a great start.

Log in to reply