Closed ADebla closed 2 months ago
You can solve this by making use of the extension class as follows:
const string template = "{Timestamp:yyyy-MM-dd HH:mm:ss} [{Level:u3}] {Message:lj}{NewLine}{Exception}";
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Verbose()
.WriteTo.File(
path: $"{Constants.LoggingDirectoryPath}/log-.txt",
rollingInterval: RollingInterval.Day,
retainedFileCountLimit: 30,
outputTemplate: template
)
.WriteTo.RichTextBox(richTextBox1, maxLogLines: 10000, outputTemplate: template)
.CreateLogger();
Let me know if this works for you.
I will close this issue as I assume it is solved. If it is not, please let me know.
Hello,
Sorry for the late reply, I have been sick from my last message and did not work on the project until now.
Thanks for your solution, it does work.
Hello,
Sorry for the late reply, I have been sick from my last message and did not work on the project until now.
Thanks for your solution, it does work.
That's okay, thanks for the reply!
I am configure multiple richtextbox log with your package:
exemple for one :
` public static void ConfigureMainLogging(RichTextBox richTextBox) { var options = new RichTextBoxSinkOptions(ThemePresets.Dark, 200, 5, true, 10000); var richTextBoxSink = new RichTextBoxSink(richTextBox, options);
But my template is not respected, I mean only in the file write. Is there a way to pass the template to the sink ?
Thanks for the help :D !