umairsyed613 / serilog.sinks.winforms Goto Github PK
View Code? Open in Web Editor NEWPrint Serilog logs from anywhere in you application into textbox or datagridview. windows forms
License: MIT License
Print Serilog logs from anywhere in you application into textbox or datagridview. windows forms
License: MIT License
Hi,
Is there any chance you could add Nuget targets for .Net 4.6.1 (this seems to be the lowest version it will support), and or .Net Core now that it has winforms support?
Hello,
can you add colors to the RichTextBoxLogControl?
It would be really helpful.
Thanks.
Describe the bug
When dragging and dropping a SimpleLogTextBox or a JsonLogTextBox control from the Toolbox onto my Form's Designer View, Visual Studio displays an error in a popup saying, "Control does not support transparent background colors." The control is not added to my Form.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The Control is expected to appear on my Form's Designer View, but doesn't.
Desktop (please complete the following information):
Additional Info
I have tried different projects and have tried adding the following line to my Form, with no luck:
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
Is your feature request related to a problem? Please describe.
When you have a long-running application, the controls will eventually fill up with information - there is currently no feature that allows to keep a maximum of n lines, rows, etc..
Describe the solution you'd like
It would be nice to have an auto-purge feature that keeps the memory footprint under control (i.e., a maximum number of rows in a grid, or lines/bytes in a textbox).
Describe alternatives you've considered
The alternative is manipulating the inner object directly, which at least in the case of your grid, requires accessing a private field.
Let's try to get some mistakes fixed. Your project has a long way to go just to become usable by anyone who wants to produce a desirable and professional application. Unfortunately, there are no other packages of this kind that I can find.
Since I am only interested in using the RichTextBoxLogControl, let's exclusively use the RichTextBoxLogControl for the examples and explanations.
Please try to use correct terminology and provide the correct code needed, so that a dummy can understand. When you make up imaginary terminology or slang such as "fetch" and provide no example of what you are talking about, it makes no sense.
RichTextBoxLogControl Issue #1
When using your provided example code, your project is adding an unneeded and undesirable extra 'space' character at the end of every line in the output. This is not acceptable and should be fixed. The root cause is discussed in Issue #2.
The example code you are providing is the following:
Log.Logger = new LoggerConfiguration()
.WriteToSimpleTextBox(new MessageTemplateTextFormatter("{Message} {Exception}"))
.CreateLogger();
The following image illustrates your incorrect implementation, which causes the extra space before the blinking cursor.
RichTextBoxLogControl Issue #2
Now let's try to avoid issue #1 by using the format that is used correctly and professionally by the Console Sink, but incorrectly by your project.
When using the example format provided by the Console Sink we have the following code:
Log.Logger = new LoggerConfiguration()
.WriteTo.Console(outputTemplate: "{Message:lj}{NewLine}{Exception}")
.WriteToSimpleTextBox(new MessageTemplateTextFormatter("{Message:lj}{NewLine}{Exception}"))
.CreateLogger();
The following image illustrates your incorrect implementation of an unneeded and undesirable extra new line at the end of every line in the output. This is not acceptable and should be fixed. You should not be adding anything that the user didn't ask to be added and doesn't want.
As you can see in the following image, the console produces a desirable, professional and correct result:
@umairsyed613 Could you please add also the target framework 'net8.0-windows7.0' to the Serilog.Sinks.WinForms package?
hello. i dont see the controls in the toolbox for serilog richbox and etc. how can i enable them ?
Hi, is it possible to release this for .net 5?
Is there a way to have two RichTextBoxLogControl and fill them with different outputs because context like special class MyClass
doesn't work;
RichTextBoxLogControl 1 | RichTextBoxLogControl 2 |
---|---|
Log for 1 | Log for 2 |
Another Log for 1 | Another Log for 2 |
Edit
Solved, I was installing the wrong package
First off. I absolutely love this Sink!!!! Thank you!!!
Is there a way to add an output template option for WriteToSimpleTextBox?
EXAMPLE:
.WriteToSimpleTextBox(outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}"))
BTY, Did I tell you THANK YOU!! and that I LOVE this Sink!!!!!!
How do I write a log to a SimpleAndRichTextBox with configuration in WinForm
{
"Serilog": {
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Default": "Warning",
"System": "Warning",
"Microsoft": "Warning"
}
},
"WriteTo": [
{ "Name": "Console" },
{
"Name": "Async",
"Args": {
"configure": [
{
"Name": "File",
"Args": {
"path": "log/log.txt",
"outputTemplate": "{NewLine}Date:{Timestamp:yyyy-MM-dd HH:mm:ss.fff}{NewLine}LogLevel:{Level}{NewLine}Class:{SourceContext}{NewLine}Message:{Message}{NewLine}{Exception}",
"rollingInterval": "3"
}
}
]
}
}
]
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.