Part of a series of tutorials on creating WPF applications in C#
In this video we add the ability to log from anywhere in the application, as well as gain information about where the log come from.
We use no third party code or libraries, just make a nice, simple, expandable logger ourselves.
Source code:
Latest code:
Nguồn:https://wijstaanvooronzegrondrechten.org/
Xem Thêm Bài Viết Khác:https://wijstaanvooronzegrondrechten.org/cong-nghe
just a note
when doing a switch after entering the enum (like level), you could click enter twice and it automatically fills all the possible enum values in the cases so no need to try to figure out the levels of each and typing them all out by yourself
I guess I am late to this party, but great videos Luke. I'll tell you when I found your videos I canceled my Plural Sight subscription. Tired of watching the same implementations that you can find in the dev docs on msdn.
Just a note on the colors in debug via vscolor extension. It currently is only supported in VS2019 now unless I missed something. In any case I ported the fasetto.Word project to a VS2019 preview and all is fine. Not sure if I will continue on with VS2019 or go back to VS2017 to finish the course. Thanks again! Greg
I really like how you leveraged tuples.
You still need to add a lock to the Log method in the BaseLogFactory or dont you? Or do you need to cast to .toList(). Which is the better way
public void Log(string message, LogLevel level = LogLevel.Informative,
[CallerMemberName] string origin = "",
[CallerFilePath] string filePath = "",
[CallerLineNumber] int lineNumber = 0)
{
// If we should not log the message as the level is too low…
if ((int)level < (int)LogOutputLevel)
return;
// If the user wants to know where the log originated from…
if (IncludeLogOriginDetails)
message = $"{message} [{Path.GetFileName(filePath)} > {origin}() > Line {lineNumber}]";
// Log to all loggers
lock (Loggers)
{
Loggers.ForEach(logger => logger.Log(message, level));
}
// Inform listeners
NewLog.Invoke((message, level));
}
can't you just use <inheritdoc />
i remember i watched one of your video few weeks ago that you re-created the core project for some reason but i couldnt remember which video was it, after i search for all your videos in this playlist, and the other asp.net playlist, finally i found it!! it is in this video, i am so happy!!
Nice shorcut for creating new classes: you select a folder and then press ALT+SHIT+C and you can type the class name even ignoring the *.cs part. Sooooo much quicker
I somewhat customized the categories for your DebugLogger and even added some padding. Works really well!
Are you have a plans to make a video about testing Fasetto Word app? Unit, integrated, load, maybe UI tests?
Which visual studio do you use
Can u actually message people with this
Thx for video, in your opinion how better send push notification from one wpf app to another wpf app, if they in the same Etherner network-SignalR or wcf?
Hello, Sir! Hope you're doing well. Thanks for the great tutorials. How to create MSI Installer for this project. Will dotnet publish -r win-x86 work for this, as you have shown in (How To Create Windows Installer MSI – .Net Core Wix) tutorial. If not then what is the other way
Thank you sir for the great tutorials.Please tutorial 02,thus the tree view and value converters,Please how did you get the images, did you downloaded them,because i followed exactly what you did but i did get the(drive.pn ,file.png, folder-closed.png, andfolder-opend.png). Please help me get them. am using visual studio 2017 enterprise if that is the problem. Please help me resolve this, Please thank you.
Morning Sir i am using your pattern of work on My app i have a question i am using generic repository Pattern with factory Pattern the question is can we intrect both pattrens and is it a good practice i am using SQLite and please make video of wpf on database using repo pattern so it will be helpful thanks in advance i have only one or two table like i have a user Table from which we can extrect 3 child object like driver or visitor etc sir i am waiting for your reply your suggestion is very valuable to me
So..Could you make a wpf tray icon tutorial?
Would love to see you work though another project like a Budget Tracking program that works with a Database more. Great work love the material!!
Amazing series, with unmatched quality. Huge thank you for sharing your knowledge! I just wanted to say that when using switch (min 57:10) with a code snippet and enumeration variable, VisualStudio will list out all enum values for you. I know it's a small thing, but still a potential time saver.
Is there a way to send messageboxes to people using your application without them having to redownload the newest version?
Awesome as always!
I wanted to add file logger which was simple but I get an issue when I want the file to have the origin details but the console to only have the message, I can't set the IoC.Logger.IncludeLogOriginDetails in the filelogger to false because the message is already created with the details, got a suggestion?
Superb bro 🙂
Thanks, Luke. This tutorial is awesome. Keep it up
Cool video as always. This is the best YT tutorial series … Anyway. I have 2 questions:
1. When you iterate over loggers, should not you use the lock?
2. You use an IoC container as a service-locator. I've read (http://blog.ploeh.dk/2010/02/03/ServiceLocatorisanAnti-Pattern/ ) that it's an antipattern, because it hides dependencies, violates encapsulation and SOLID principles etc. I'm really curious, what are your thoughts on that?
Many thanks again. Keep it up.greate tutorials
thanks Luke , you are AWESOME .
Thank you for continuing to publish these tutorials. I keep learning more and more! 🙂
thx very much best wpf tutorial
How did you get the dark file explorer theme?