better test messages, add a license

This commit is contained in:
Antranig Vartanian 2025-06-15 04:03:58 +04:00
parent 7b4a1a6c1f
commit 20b6f0c80a
No known key found for this signature in database
GPG key ID: DE3998662D59F21C
4 changed files with 39 additions and 16 deletions

View file

@ -11,20 +11,20 @@ BEGIN
(* Show default level (INFO) in action *)
log.Info("Logger initialized");
log.InfoInt("Connected users: ", 42);
log.InfoInt("The answer to life, the universe, and everything: ", 42);
(* Prefix usage *)
log.SetPrefix("unit-test");
log.Warn("Warning with prefix");
log.WarnInt("Sessions: ", 5);
log.SetPrefix("Web Server");
log.Warn("Web Server is loading slowly");
log.WarnInt("Current threads: ", 4);
log.Error("Something went wrong");
log.ErrorInt("Error code: ", -7);
log.Error("Something went wrong...");
log.ErrorInt("The function returned: ", -1);
(* Switch to DEBUG level *)
log.SetLevel(Logger.DEBUG);
log.Debug("This is a debug message");
log.DebugInt("File descriptor: ", 3);
log.DebugInt("File descriptor: ", 73);
(* Clear prefix *)
log.ClearPrefix();

View file

@ -1,9 +1,9 @@
[2025-06-15T03:27:27Z] [INFO] Logger initialized
[2025-06-15T03:27:27Z] [INFO] Connected users: 42
[2025-06-15T03:27:27Z] [WARN] [unit-test] Warning with prefix
[2025-06-15T03:27:27Z] [WARN] [unit-test] Sessions: 5
[2025-06-15T03:27:27Z] [ERROR] [unit-test] Something went wrong
[2025-06-15T03:27:27Z] [ERROR] [unit-test] Error code: -7
[2025-06-15T03:27:27Z] [DEBUG] [unit-test] This is a debug message
[2025-06-15T03:27:27Z] [DEBUG] [unit-test] File descriptor: 3
[2025-06-15T03:27:27Z] [INFO] Prefix cleared
[2025-06-15T04:02:43Z] [INFO] Logger initialized
[2025-06-15T04:02:43Z] [INFO] The answer to life, the universe, and everything: 42
[2025-06-15T04:02:43Z] [WARN] [Web Server] Web Server is loading slowly
[2025-06-15T04:02:43Z] [WARN] [Web Server] Current threads: 4
[2025-06-15T04:02:43Z] [ERROR] [Web Server] Something went wrong...
[2025-06-15T04:02:43Z] [ERROR] [Web Server] The function returned: -1
[2025-06-15T04:02:43Z] [DEBUG] [Web Server] This is a debug message
[2025-06-15T04:02:43Z] [DEBUG] [Web Server] File descriptor: 73
[2025-06-15T04:02:43Z] [INFO] Prefix cleared