Closed JetsONPW closed 2 years ago
Have you read https://github.com/nreco/logging/blob/master/README.md ?
Yes, that's what I followed to add the logging to my services, but I do not see a code example of how to actually add something to the log. Looking at the actual API from within Visual Studio, I do see the Log
function can be called from a FileLogger
object. Does this mean I should instanciate a new FileLogger
object in each class where I wish to have logging ? Or should I be looking to use a single instance of FileLogger
that I share across classes ? What's the best practice there ?
Also, with regards to the actual log function, what does the TState
variable actually represent ? As for the formatter
, am I right in assuming that I should set up a formatter as seen in this documentation page ? https://docs.microsoft.com/en-us/dotnet/core/extensions/console-log-formatter#implement-a-custom-formatter
Thanks, Sorry for being very nooby.
You shouldn't use logging provider directly -- this is a plugin for a common MS logging infrastructure. To add a log entry your code uses ILogger interface as described here: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/#create-logs-1
Sounds good, thanks.
Completely new to the C#/.NET Core environment. I've looked everywhere in the Microsoft Docs and on Google/Stack Overflow but cannot find a single decent code sample for NReco file logging. Is there any way you guys could add even just a basic implementation of NReco file logging to your README please ? Would help me out immensely.
I saw you guys said it's similar to ConsoleLogger so I looked that up and didn't come across simple code samples for that either.
Thanks.