LM-OverlyFastCsharpConsoleLogger
1.1.6
dotnet add package LM-OverlyFastCsharpConsoleLogger --version 1.1.6
NuGet\Install-Package LM-OverlyFastCsharpConsoleLogger -Version 1.1.6
<PackageReference Include="LM-OverlyFastCsharpConsoleLogger" Version="1.1.6" />
<PackageVersion Include="LM-OverlyFastCsharpConsoleLogger" Version="1.1.6" />
<PackageReference Include="LM-OverlyFastCsharpConsoleLogger" />
paket add LM-OverlyFastCsharpConsoleLogger --version 1.1.6
#r "nuget: LM-OverlyFastCsharpConsoleLogger, 1.1.6"
#:package LM-OverlyFastCsharpConsoleLogger@1.1.6
#addin nuget:?package=LM-OverlyFastCsharpConsoleLogger&version=1.1.6
#tool nuget:?package=LM-OverlyFastCsharpConsoleLogger&version=1.1.6
OOCCL
A simple lightweight console logger I tried to make fast. The
and example of how it looks in console;
Key features include:
- Multithreadingly(yet not too many threads) printing list of logs
- not too complex
- colorful console(each log type is mapped to a color!)
KNOWN ISSUES
1. the quickLog.printX(msgs)
methods do not give the proper line number and and file path.
- I think this is a limitation of c# as paramters with the
params
key word have to be at the end of the paramaters... but so do optional paramaters.- I don't think I can fix this without doing some funky stuff with... maybe method overloading? I don't know..
USAGE
If you want a quick look through of usage, you can just look at this which is the source code to the other
.csproj
in this repository. However if you want a more indepth explanation we can start with,
First with logging messages to console
there are a few ways to log various kinds of messages. You could add logs to a built in list as so;
quickLog.error("This is an error message").AddToList();
quickLog.warning("This is a warning message").AddToList();
quickLog.info("This is an info message").AddToList();
quickLog.debug("This is a debug message").AddToList();
Log.List.Print();
But I found this only gave improvements for large amount of logs, so if you dont have that many you can just log normally. Heres an example that demonstrates as such but also show's making custom logs;
new Log("Custom log message", 1, Log.Type.error).print();
new Log("Custom log message", 1, Log.Type.warning).print();
quickLog.info("informatic message").print();
quickLog.debug("debug message").print();
Or if you don't wanna type too much you can just do this;
quickLog.printInfo("as so");
The list
you shouldn't use the list all too often, but there are some methods for it.
Log.List.SortByAmount();
Log.List.SortByMsg();
Log.List.SortByType();
Really this is just a side effect of how I decided to print multiple log's that I decided to add some functionality for
Along with logging to console
you can also log Exceptions(which get printed to both console AND to a file), or to a file. This looks as so;
someLog.writeToFile("C:\\exampleLogToFile.txt", true); // this is global path
someLog.writeToFile("exampleLogToFile.txt"); // this is relative path
someLog.writeToFile("exampleLogToFile.txt", false); // this is also relative path
and with exceptions;
Log exceptionLog = quickLog.Error("Uh oh, something went wrong!");
exceptionLog.Exception(); // this will also write to the file "!Exception on {MM-dd} at {HH;mm}" in the same folder as your compiled project
Lastly, time
The Timer
class allows you to measure elapsed time; mostly for benchmarking.
Timer.start();
Console.WriteLine($"timer is running, started at {Timer.getStartTime}");
Console.WriteLine($"at {Timer.currTimeMS} milliseconds : {Timer.currTimeS} seconds");
stop();
Timer.start();
Timer.printCurrMs();
Timer.printCurrS();
#if secondsExample
Timer.printS();
#else
Timer.printMs();
#endif
PLANS ON FORWARD
Not much on planned implementations for now, but I do plan on adding improvements I may see and adding some new features. Updates probably wont be too frequent as this is just something I decided to make for myself and mostly myself.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net7.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.
Changed some small things, removed printSameLine for end paramater in print() kinda like python's print(). also made FormatLog public as I accidently had it private