• Login
Community
  • Login

NLog support in Notepad++?

Scheduled Pinned Locked Moved Notepad++ & Plugin Development
syntax highlightlogging
6 Posts 4 Posters 950 Views
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.
  • S
    scampsd
    last edited by Apr 15, 2024, 9:18 AM

    Good morning,
    I’m a C# developer.
    My application writes logs to output files, using the NLog libraries (I don’t have enough reputation to insert the hyperlink). I have the habit of using Notepad++ for reading those logfiles.

    I have been using Notepad++ for reading source code (in ABL), so I am aware of the syntax highlighting feature of Notepad++.

    However, that syntax highlighting is “word-based”: only a single word is highlighted, based on configuration files for that particular programming language.

    Logfiles, generated by NLog, typically look as follows:

    2024-04-08 09:45:14.5495 | Warn | <Namespace>.<Class>.<Method> | DataChange failed: Item values are null or bad quality
    2024-04-08 09:45:14.5808 | Debug | <Namespace>.<Class>.<Method> | ReadValue. groupType=[STATUS], group=[CONNECTION12], item=[ActualPositionValve] 
    2024-04-08 09:45:14.6120 | Debug | <Namespace>.<Class>.<Method> | Get Location of [Vehicle2]. ActualLocation=[LOC16], Automatic=[True] 
    2024-04-08 09:45:14.6120 | Info | <Namespace>.<Class>.<Method> | Data sent : ZERO
    

    I am capable of creating a configuration file, which highlights the NLog levels (Warn, Debug, Info, …), which make the mentioned logs look as follows:

    2cf4c74d-a8c4-42ff-a8d0-61e456cead26-image.png

    This is not what I want: I would like to highlight the entire line, based on that NLog level, something like:

    969aedf4-9458-4820-b0dd-898293d804b5-image.png

    I know there are ways to get this done, using a kind of “regular expression” approach in the configuration files, but for larger files (logfiles are easily hundreds of Megabytes large), that syntax highlighting takes so long that the whole idea becomes a burden instead of a feature.

    Hence my question: is there a feature for highlighting, or are there plans to develop highlighting, where entire lines get highlighted, based on an entry inside that line?

    Thanks in advance
    Dominique

    E P 2 Replies Last reply Apr 15, 2024, 10:50 AM Reply Quote 1
    • E
      Ekopalypse @scampsd
      last edited by Apr 15, 2024, 10:50 AM

      @scampsd

      Have you tried creating an udl but without defining anything and using the EnhanceAnyLexer plugin in addition, which at the moment only colors the foreground but only edits the currently visible lines and therefore should be usable with large files?

      S 1 Reply Last reply Apr 15, 2024, 10:55 AM Reply Quote 1
      • S
        scampsd @Ekopalypse
        last edited by Apr 15, 2024, 10:55 AM

        @Ekopalypse .
        I have done that, it works more or less, but I would like to have it extension-based, while the EnhanceAnyLexer looks like something, which needs to be enabled/disabled every time.

        E 1 Reply Last reply Apr 15, 2024, 11:22 AM Reply Quote 0
        • E
          Ekopalypse @scampsd
          last edited by Apr 15, 2024, 11:22 AM

          @scampsd

          @scampsd said in NLog support in Notepad++?:

          looks like something, which needs to be enabled/disabled every time

          this should not be the case. Once you have defined the udl and its extension, use Enhance current language from the EnhanceAnyLexer plugin and define the regex with its colors. Save it and now every time a file is opened that is assigned the defined udl, the EnhanceAnyLexer will be triggered.

          1 Reply Last reply Reply Quote 2
          • P
            PeterJones @scampsd
            last edited by Apr 15, 2024, 1:35 PM

            @scampsd ,

            I believe that the AnalysePlugin has some ways that make highlighting/reading logfiles easier. I don’t know if it has the ability to automatically apply styles, but it would definitely be something to try out.

            A 1 Reply Last reply Apr 15, 2024, 1:38 PM Reply Quote 0
            • A
              Alan Kilborn @PeterJones
              last edited by Alan Kilborn Apr 15, 2024, 1:39 PM Apr 15, 2024, 1:38 PM

              @PeterJones said in NLog support in Notepad++?:

              Analyse plugin

              My first thought on reading the OP’s original post was that he is already using Analyse. Maybe not though.

              if it has the ability to automatically apply styles

              I don’t believe so…but it has been some time since I used it (at work) and I don’t have it at home…

              1 Reply Last reply Reply Quote 2
              2 out of 6
              • First post
                2/6
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors