Tiny.Logger.1.0.0
1.0.0
dotnet add package Tiny.Logger.1.0.0 --version 1.0.0
NuGet\Install-Package Tiny.Logger.1.0.0 -Version 1.0.0
<PackageReference Include="Tiny.Logger.1.0.0" Version="1.0.0" />
paket add Tiny.Logger.1.0.0 --version 1.0.0
#r "nuget: Tiny.Logger.1.0.0, 1.0.0"
// Install Tiny.Logger.1.0.0 as a Cake Addin
#addin nuget:?package=Tiny.Logger.1.0.0&version=1.0.0
// Install Tiny.Logger.1.0.0 as a Cake Tool
#tool nuget:?package=Tiny.Logger.1.0.0&version=1.0.0
TinyLogger
Tiny File Logger for logging helpful information about your project to the console, or a .txt
log file.
Logging
First create a new instance of the Logger
class.
Logger _logger = new Logger
{
LogFilePath = @"C:\Path\to\Log.txt",
UseLogFile = true,
Width = 100,
};
Next lets log some info to the console.
_logger.Log("Some Log Info");
This will simply log Some Log Info
to both the console
and log.txt
file. Remember UseLogFile = true
, if you only want the info to show up in the console then set UseLogFile = false
Next we can add in the sending
object
_logger.Log(this, "Some Log Info");
Will output [Tester]: Some Log Info
to the console or log file, or both.
We can also set the color of the message(console only) depending on the severity level of the message
_logger.Log(this, "Some Log Info", ConsoleLevel.Error);
Will output [Tester]: Some Log Info
in the color red.
There are 5 ConsoleLevels to chose from
- Error: Red,
- Warning: Yellow,
- Info: White,
- Message: Blue,
- Success: Green,
Table
Create a new Table
instance
Table _table = new Table(_logger);
You will notice it requires the Logger
from earlier.
Add in your Header
_table.AddHeader(new List<string>{"Col 1", "Col 2", "Col 3"});
And some Rows
_table.AddRow(new List<string>{"Item 1", "Item 2", "Item 3"});
_table.AddRow(new List<string>{"Item 4", "Item 5", "Item 6"});
To output the tables contents call the _table.Output();
You can set the output color of the table by setting its ConsoleLevel
property.
If you plan to resue the table
multiple times you will need to call its ClearHeader()
and ClearRows()
methods before each output.
Product | Versions 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. |
-
net6.0
- No dependencies.
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 |
---|---|---|
1.0.0 | 189 | 12/2/2022 |