diff --git a/alire.gpr b/alire.gpr index e93fb04d..476e43c8 100644 --- a/alire.gpr +++ b/alire.gpr @@ -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; - diff --git a/alire_env.gpr b/alire_env.gpr index dce70c6b..5715ff9b 100644 --- a/alire_env.gpr +++ b/alire_env.gpr @@ -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"); diff --git a/deps/simple_logging/.gitignore b/deps/simple_logging/.gitignore new file mode 100644 index 00000000..cd674ece --- /dev/null +++ b/deps/simple_logging/.gitignore @@ -0,0 +1,11 @@ +# Object files +lib +obj + +# Ada Library Information +*.ali + +# Miscellaneous cruft +*.cgpr +*.db +*.xml diff --git a/deps/simple_logging/simple_logging.gpr b/deps/simple_logging/simple_logging.gpr new file mode 100644 index 00000000..2007b920 --- /dev/null +++ b/deps/simple_logging/simple_logging.gpr @@ -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; diff --git a/deps/simple_logging/simple_logging_alr.gpr b/deps/simple_logging/simple_logging_alr.gpr new file mode 100644 index 00000000..8bf34f43 --- /dev/null +++ b/deps/simple_logging/simple_logging_alr.gpr @@ -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; diff --git a/deps/simple_logging/src/simple_logging.adb b/deps/simple_logging/src/simple_logging.adb new file mode 100644 index 00000000..f2785ebe --- /dev/null +++ b/deps/simple_logging/src/simple_logging.adb @@ -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; diff --git a/deps/simple_logging/src/simple_logging.ads b/deps/simple_logging/src/simple_logging.ads new file mode 100644 index 00000000..fa28e094 --- /dev/null +++ b/deps/simple_logging/src/simple_logging.ads @@ -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;