MetroLog to .Net MAUI in a Simple Way #25
mgungorchamp
started this conversation in
General
Replies: 1 comment 5 replies
-
You can already get a logger with a static method, so I don't really understand the point of this helper.
|
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I added these two functions
` private static ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddStreamingFileLogger(options =>
{
options.RetainDays = 2;
options.FolderPath = Path.Combine(FileSystem.CacheDirectory, "InfoBoardLogs");
}));
And used in each file I need logging like the following
private readonly ILogger _logger;
_logger = Utilities.Logger(nameof("MyFile"));
or
_logger = Utilities.Logger(nameof(FileDownloadService));
and use anywhere like this
_logger.LogInformation($"**Welcome");
Youtube video showing the usage
https://youtu.be/8CPXDHQlBa0
Beta Was this translation helpful? Give feedback.
All reactions