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 changedSay 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?
Thanks,
John -
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
EnhanceAnyLexer.pythat @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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login