NLog support in Notepad++?
-
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:
This is not what I want: I would like to highlight the entire line, based on that NLog level, something like:
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 -
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?
-
@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. -
@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. -
@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.
-
@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…