better test messages, add a license
This commit is contained in:
parent
7b4a1a6c1f
commit
20b6f0c80a
4 changed files with 39 additions and 16 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
build
|
||||
22
LICENSE.txt
Normal file
22
LICENSE.txt
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Copyright 2025 Antranig Vartanian.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation and/or
|
||||
other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue