Simple logging lib
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
with "semantic_versioning.gpr";
|
||||
with "semantic_versioning";
|
||||
with "simple_logging";
|
||||
|
||||
project Alire is
|
||||
|
||||
@@ -29,4 +30,3 @@ project Alire is
|
||||
end Ide;
|
||||
|
||||
end Alire;
|
||||
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
aggregate project Alire_Env is
|
||||
|
||||
for Project_Path use ("deps/semver");
|
||||
for Project_Path use ("deps/semver",
|
||||
"deps/simple_logging");
|
||||
|
||||
for Project_Files use ("alire.gpr");
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# Object files
|
||||
lib
|
||||
obj
|
||||
|
||||
# Ada Library Information
|
||||
*.ali
|
||||
|
||||
# Miscellaneous cruft
|
||||
*.cgpr
|
||||
*.db
|
||||
*.xml
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
project Simple_Logging is
|
||||
|
||||
for Library_Name use "simple_logging";
|
||||
for Library_Version use "0.0.0";
|
||||
|
||||
for Source_Dirs use (".", "src");
|
||||
for Object_Dir use "obj";
|
||||
for Library_Dir use "lib";
|
||||
|
||||
package Builder is
|
||||
for Switches ("ada") use ("-j0", "-g");
|
||||
end Builder;
|
||||
|
||||
package Compiler is
|
||||
for Switches ("ada") use ("-gnatVa", "-gnatwa", "-g", "-O2", "-gnata", "-gnat12", "-gnato", "-fstack-check");
|
||||
end Compiler;
|
||||
|
||||
package Binder is
|
||||
for Switches ("ada") use ("-Es");
|
||||
end Binder;
|
||||
|
||||
end Simple_Logging;
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
aggregate project Simple_Logging_Alr is
|
||||
|
||||
-- This is an automatically generated file. DO NOT EDIT MANUALLY!
|
||||
|
||||
for Project_Files use ("simple_logging.gpr");
|
||||
|
||||
for Project_Path use (
|
||||
"/home/jano/.cache/alire/projects/alire_0.4.0_da62fcae",
|
||||
"/home/jano/.cache/alire/projects/alr_0.4.0_146fe156",
|
||||
"/home/jano/.cache/alire/projects/semantic_versioning_1.0.0_4f9dd639");
|
||||
|
||||
for external ("ALIRE") use "True";
|
||||
|
||||
end Simple_Logging_Alr;
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
with GNAT.IO;
|
||||
|
||||
package body Simple_Logging is
|
||||
|
||||
function Prefix (Level : Levels) return String is
|
||||
(case Level is
|
||||
when Error => "ERROR: ",
|
||||
when WARNING => "Warning: ",
|
||||
when Info => "",
|
||||
when Detail => "-> ",
|
||||
when Debug => "-->> ");
|
||||
|
||||
---------
|
||||
-- Log --
|
||||
---------
|
||||
|
||||
procedure Log (S : String; Level : Levels := Info) is
|
||||
begin
|
||||
if Level <= Simple_Logging.Level then
|
||||
GNAT.IO.Put_Line (Prefix (Level) & S);
|
||||
end if;
|
||||
end Log;
|
||||
|
||||
end Simple_Logging;
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package Simple_Logging with Preelaborate is
|
||||
|
||||
type Levels is (Error,
|
||||
Warning,
|
||||
Info,
|
||||
Detail,
|
||||
Debug);
|
||||
-- From most important to less important
|
||||
|
||||
Level : Levels := Info;
|
||||
-- Any message at the same level or below will be output to console
|
||||
|
||||
procedure Log (S : String; Level : Levels := Info);
|
||||
-- Report a log message
|
||||
|
||||
end Simple_Logging;
|
||||
Reference in New Issue
Block a user