Community
    • Login

    NLog support in Notepad++?

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    syntax highlightlogging
    6 Posts 4 Posters 765 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

      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

      EkopalypseE PeterJonesP 2 Replies Last reply Reply Quote 1
      • EkopalypseE
        Ekopalypse @scampsd
        last edited by

        @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 Reply Quote 1
        • S
          scampsd @Ekopalypse
          last edited by

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

          EkopalypseE 1 Reply Last reply Reply Quote 0
          • EkopalypseE
            Ekopalypse @scampsd
            last edited by

            @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
            • PeterJonesP
              PeterJones @scampsd
              last edited by

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

              Alan KilbornA 1 Reply Last reply Reply Quote 0
              • Alan KilbornA
                Alan Kilborn @PeterJones
                last edited by Alan Kilborn

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