This page is about the
Logger class available in
PeyrSharp.Env. You can find here all of its methods.
This class is
Logger class is part of the
PeyrSharp.Env module, and is compatible with all of these frameworks and platforms:
|Package/Platform||Windows||macOS||Linux + others|
|Framework||.NET 5||.NET 6||.NET 7|
Some methods, classes or features of
PeyrSharp.Env might not be available in all platforms.
Log(message, filePath, dateTime)
Log() method logs a specific message alongside a timestamp into a file. This method does not return a value (
You can call this method multiple times on the same file and it will append the message to it.
|The message or text that needs to be logged.|
|The path where the file should be written.|
|The timestamp of the log, the time when the log was made.|
using PeyrSharp.Env; Logger.Log("Hello", @"C:\Logs\log1.txt", DateTime.Now) // The line above will generate a file with the following content: // [10/31/2022 09:23:18] Hello