Community
    • Login

    My first user defined language

    Scheduled Pinned Locked Moved General Discussion
    3 Posts 2 Posters 456 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • John DaviesJ Offline
      John Davies
      last edited by John Davies

      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?

      Thanks,
      John

      PeterJonesP 1 Reply Last reply Reply Quote 0
      • PeterJonesP Offline
        PeterJones @John Davies
        last edited by

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

        5f81f462-067c-4f25-84cf-82f95b35c443-image.png

        If that’s not good enough, you can add extra highlighting to a lexer (including UDL lexer) using regexes via the script EnhanceAnyLexer.py 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.

        1 Reply Last reply Reply Quote 1
        • John DaviesJ Offline
          John Davies
          last edited by

          Thank you. That’s a great start.

          1 Reply Last reply Reply Quote 0

          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
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors