Replies: 1 comment 1 reply
-
Hey @bstordrup, the custom {
"NotepadProcessName": "MyNotepadMonitor"
} Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
.WriteTo.Notepad(notepadProcessFinderFunc: () =>
{
return Process.GetProcessesByName(Configuration["NotepadProcessName"])
.Where(p => !p.HasExited)
.OrderByDescending(p => p.StartTime)
.FirstOrDefault();
})
.CreateLogger(); |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
If I provide a copy of the Notepad.exe file with a different name (say MyNotepadMonitor.exe), I can provide a custom
Func<Process>
that searches for this process name in the call toLoggerConfiguration().WriteTo.Notepad()
.But what if I don't use this, but rely entirely on the configuration in appsettings.json? Is it possible to provide a function there? Or would it be an option to add a parameter that specifies the name of the executable to use instead of Notepad.exe?
Beta Was this translation helpful? Give feedback.
All reactions