new version
This commit is contained in:
parent
e204e5538d
commit
772c7389a8
23 changed files with 576 additions and 430 deletions
92
Tests/.log
Normal file
92
Tests/.log
Normal file
|
@ -0,0 +1,92 @@
|
|||
[7/25/2024 3:37:21 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:21 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:21 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:21 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:21 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:21 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:21 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:21 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:21 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:21 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:21 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:21 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:21 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:21 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:21 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:21 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:22 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:22 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:22 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:22 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:22 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:22 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:22 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:22 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:22 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:22 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:22 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:22 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:22 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:22 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:22 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:22 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:22 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:22 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:23 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:23 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:23 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:23 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:23 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:23 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:23 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:23 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:23 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:23 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:23 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:23 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:23 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:23 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:23 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:23 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:23 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:23 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:24 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:24 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:24 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:24 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:24 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:24 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:24 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:24 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:24 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:24 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:24 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:24 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:24 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:24 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:24 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:24 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:24 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:24 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:25 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:25 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:25 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:25 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:25 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:25 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:25 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:25 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:25 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:25 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:25 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:25 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:25 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:25 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:25 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:25 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:25 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:25 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:26 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:26 PM][Debug]: Lets debug something
|
||||
[7/25/2024 3:37:26 PM][Trace]: Tracey
|
||||
[7/25/2024 3:37:26 PM][Debug]: Lets debug something
|
|
@ -4,3 +4,4 @@ Dependencies = {corlib = "*", LybLog = "*"}
|
|||
[Project]
|
||||
Name = "Tests"
|
||||
StartupObject = "Tests.Program"
|
||||
ProcessorMacros = ["ENABLE_LYBLOG"]
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
/*
|
||||
Feature List:
|
||||
|
||||
-Output to Console
|
||||
-Output
|
||||
-Custom Formatting
|
||||
-Custom Coloring
|
||||
|
||||
-Output to Ide
|
||||
|
||||
-Output to Callbacks
|
||||
|
||||
-Output to files
|
||||
-Cache in cache before outputting
|
||||
-Write to cache when the app closes
|
||||
-Write to cache on fatal
|
||||
-Flush the cache manually
|
||||
*/
|
|
@ -1,94 +1,27 @@
|
|||
namespace Tests;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using LybLog;
|
||||
class Program
|
||||
{
|
||||
public static Monitor MainEnd = new .() ~ delete _;
|
||||
public static void Main()
|
||||
{
|
||||
Console.WriteLine("First step of testing. All basic logging functions");
|
||||
Log.Trace("This is a trace log");
|
||||
Log.Debug("This is a debug log");
|
||||
Log.Info("This is a info log");
|
||||
Log.Warn("This is a warn log");
|
||||
Log.Error("This is a error log");
|
||||
Log.Fatal("This is a fatal log");
|
||||
Console.ReadLine(.. scope .());
|
||||
|
||||
Console.WriteLine("Second step of testing. Logging to the ide");
|
||||
Log.Settings.DoConsoleLog = false;
|
||||
Log.Settings.DoIdeLog = true;
|
||||
Log.Trace("This is a trace log");
|
||||
Log.Debug("This is a debug log");
|
||||
Log.Info("This is a info log");
|
||||
Log.Warn("This is a warn log");
|
||||
Log.Error("This is a error log");
|
||||
Log.Fatal("This is a fatal log");
|
||||
Console.ReadLine(.. scope .());
|
||||
|
||||
Console.WriteLine("Third step of testing. Logging to a callback");
|
||||
Log.Settings.DoConsoleLog = false;
|
||||
Log.Settings.DoIdeLog = false;
|
||||
Log.Settings.DoCallbackLog = true;
|
||||
Log.Settings.Callbacks.Add(new => CallbackTest);
|
||||
Log.Trace("This is a trace log");
|
||||
Log.Debug("This is a debug log");
|
||||
Log.Info("This is a info log");
|
||||
Log.Warn("This is a warn log");
|
||||
Log.Error("This is a error log");
|
||||
Log.Fatal("This is a fatal log");
|
||||
Console.ReadLine(.. scope .());
|
||||
|
||||
Console.WriteLine("Fourth step of testing. log levels. The followign logs should only show warn or higher");
|
||||
Log.Settings.DoCallbackLog = false;
|
||||
Log.Settings.DoConsoleLog = true;
|
||||
Log.Settings.LogLevel = .Warn;
|
||||
Log.Trace("This is a trace log");
|
||||
Log.Debug("This is a debug log");
|
||||
Log.Info("This is a info log");
|
||||
Log.Warn("This is a warn log");
|
||||
Log.Error("This is a error log");
|
||||
Log.Fatal("This is a fatal log");
|
||||
Console.ReadLine(.. scope .());
|
||||
|
||||
Console.WriteLine("Fith step of testing. Logging to a File");
|
||||
Log.Settings.DoConsoleLog = false;
|
||||
Log.Settings.LogLevel = .Trace;
|
||||
Log.Settings.DoFileLog = true;
|
||||
Log.Settings.LogFilePath = "test.log";
|
||||
Log.Trace("This is a trace log");
|
||||
Log.Debug("This is a debug log");
|
||||
Log.Info("This is a info log");
|
||||
Log.Warn("This is a warn log");
|
||||
Log.Error("This is a error log");
|
||||
Log.Fatal("This is a fatal log");
|
||||
Console.ReadLine(.. scope .());
|
||||
MainEnd.Enter();
|
||||
|
||||
Console.WriteLine("Sixth step of testing. Cleaning file upon initialization");
|
||||
Console.WriteLine("The test.log file should now be cleared");
|
||||
Log.Settings.ClearLogFileOnLoad = true;
|
||||
Console.ReadLine(.. scope .());
|
||||
|
||||
Console.WriteLine("Seventh step of testing. File logger caching");
|
||||
Console.WriteLine("The file should still have no contents, since it waits for the cache to be fille");
|
||||
Log.Settings.CacheSize = 3;
|
||||
Log.Settings.DoConsoleLog = true;
|
||||
Log.Trace("This is a trace log");
|
||||
Log.Debug("This is a debug log");
|
||||
Log.Info("This is a info log");
|
||||
Console.WriteLine("It has been logged but no contents are in the file");
|
||||
Console.ReadLine(.. scope .());
|
||||
Log.Warn("This is a warn log");
|
||||
Log.Error("This is a error log");
|
||||
Console.WriteLine("Warn should be logged but error shouldnt due to cache sizes");
|
||||
Console.WriteLine("Once fatal is logged it should be though, since fatal forces a cache empty");
|
||||
Console.ReadLine(.. scope .());
|
||||
Log.Fatal("This is a fatal log");
|
||||
Console.ReadLine(.. scope .());
|
||||
|
||||
}
|
||||
|
||||
public static void CallbackTest(LogLevel p, String pMessage)
|
||||
{
|
||||
Console.WriteLine(scope $"{p.ToString(.. scope .())} This is a callback: {pMessage}");
|
||||
var t = new Thread(new () => {
|
||||
while(!MainEnd.TryEnter())
|
||||
{
|
||||
Log.Trace("Tracey");
|
||||
Log.Debug("Lets debug something");
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
});
|
||||
t.Start();
|
||||
Console.Read();
|
||||
MainEnd.Exit();
|
||||
t.Join();
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
[12/19/2022 10:46:54 AM]:[TRACE]:This is a trace log
|
||||
[12/19/2022 10:46:54 AM]:[DEBUG3]:This is a debug log
|
||||
[12/19/2022 10:46:54 AM]:[INFO]:This is a info log
|
||||
[12/19/2022 10:46:57 AM]:[WARN]:This is a warn log
|
||||
[12/19/2022 10:46:57 AM]:[ERROR]:This is a error log
|
||||
[12/19/2022 10:46:57 AM]:[FATAL]:This is a fatal log
|
Loading…
Add table
Add a link
Reference in a new issue