Duke.LogWriter 2.0.2

dotnet add package Duke.LogWriter --version 2.0.2
NuGet\Install-Package Duke.LogWriter -Version 2.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Duke.LogWriter" Version="2.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Duke.LogWriter --version 2.0.2
#r "nuget: Duke.LogWriter, 2.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Duke.LogWriter as a Cake Addin
#addin nuget:?package=Duke.LogWriter&version=2.0.2

// Install Duke.LogWriter as a Cake Tool
#tool nuget:?package=Duke.LogWriter&version=2.0.2

About Duke.LogWriter

That small library is designed for creating log files and is usually used in command-line applications. By default, do not require any settings.

Installation

A simple way is to install it from the Nuget package library and it is ready to use. No additional settings are required.

dotnet add package Duke.LogWriter

Usage

using Duke.LogWriter;
LogWriter.Instance.WriteLog("Hello world", true);

That code will create in your application work directory a new subfolder with the name logs and put the file in the format DukeLogWriter_yyyy_MM_dd.txt. The log will look like

[05:57:01] Hello world

Write Header

LogWriter.Instance.WriteHeader("Application start", true);

That code will print header text with formatting.

[06:27:45] ================================================================================
[06:27:45] =============================== Application start ==============================
[06:27:45] ================================================================================

File Mask

The File mask default value is DukeLogWriter_{date}.txt. You can change that mask.

LogWriter.Instance.FileMask = "TestLog_{date}.txt";

After that, all files will be in the format TestLog_yyyy_MM_dd.txt

Line Mask

The Line mask by default contains a time stamp + log string [{time}] {log}. We can change it and remove the time value.

LogWriter.Instance.LineMask = "{log}";
LogWriter.Instance.WriteLog("Hello world", true);

As a result, there will not be a time stamp on the log line.

Log Folder

The logger by default creates a subfolder with the name logs. You can change the name of the folder or set an empty string (will be used current application folder).

LogWriter.Instance.LogFolder = "BuildLogs";

Show In Console

By default, the logger does not print anything to the output console. It can be changed in two ways. Set the value to true

LogWriter.Instance.WriteLog("Hello world", true);

or by changing the default value.

LogWriter.Instance.ShowInConsoleDefault = true;
LogWriter.Instance.WriteLog("Hello world");
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.2 149 6/12/2023
2.0.1 128 6/12/2023
2.0.0 131 6/11/2023
1.1.4 467 12/21/2019