From 5c99f3f3b4c9248fba6d33a0552ac239a229762f Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Tue, 9 Apr 2024 14:35:57 +0200 Subject: [PATCH] Gogga (legacy) - Disabled --- source/gogga/core.d | 592 ++++++++++++++++++++++---------------------- 1 file changed, 293 insertions(+), 299 deletions(-) diff --git a/source/gogga/core.d b/source/gogga/core.d index 5af7545..227148f 100644 --- a/source/gogga/core.d +++ b/source/gogga/core.d @@ -7,361 +7,355 @@ import dlog; import dlog.utilities : flatten; import std.array : join; -import gogga.transform; -import gogga.context; +// import gogga.transform; +// import gogga.context; -/** - * The logging class which provides the logging print - * calls, controlling of style and whether to debug or - * not - */ -public class GoggaLogger : Logger -{ - /** - * The custom transformer - */ - private GoggaTransform gTransform = new GoggaTransform(); - /** - * Whether debug prints are enabled or not - */ - private bool debugEnabled = false; - /** - * Constructs a new GoggaLOgger - */ - this() - { - super(gTransform); - } + +// /** +// * The logging class which provides the logging print +// * calls, controlling of style and whether to debug or +// * not +// */ +// public class GoggaLogger : Logger +// { +// /** +// * The custom transformer +// */ +// private GoggaTransform gTransform = new GoggaTransform(); + + // /** + // * Whether debug prints are enabled or not + // */ + // private bool debugEnabled = false; + +// /** +// * Constructs a new GoggaLOgger +// */ +// this() +// { +// super(gTransform); +// } - /** - * Our underlying logging implementation - * - * Params: - * text = the text to write - */ - public override void logImpl(string text) - { - import std.stdio : write; - write(text); - } +// /** +// * Our underlying logging implementation +// * +// * Params: +// * text = the text to write +// */ +// public override void logImpl(string text) +// { +// import std.stdio : write; +// write(text); +// } - /** - * Set the style of print outs - * - * Params: - * mode = the GoggaMode wanted - */ - public void mode(GoggaMode mode) - { - gTransform.setMode(mode); - } +// /** +// * Set the style of print outs +// * +// * Params: +// * mode = the GoggaMode wanted +// */ +// public void mode(GoggaMode mode) +// { +// gTransform.setMode(mode); +// } - /** - * Logs using the default context an arbitrary amount of arguments - * specifically setting the context's level to ERROR - * - * Params: - * segments = the arbitrary argumnets (alias sequence) - * __FILE_FULL_PATH__ = compile time usage file - * __FILE__ = compile time usage file (relative) - * __LINE__ = compile time usage line number - * __MODULE__ = compile time usage module - * __FUNCTION__ = compile time usage function - * __PRETTY_FUNCTION__ = compile time usage function (pretty) - */ - public void error(TextType...)(TextType segments, - string c1 = __FILE_FULL_PATH__, - string c2 = __FILE__, ulong c3 = __LINE__, - string c4 = __MODULE__, string c5 = __FUNCTION__, - string c6 = __PRETTY_FUNCTION__) - { - /* Use the context `GoggaContext` */ - GoggaContext defaultContext = new GoggaContext(); +// /** +// * Logs using the default context an arbitrary amount of arguments +// * specifically setting the context's level to ERROR +// * +// * Params: +// * segments = the arbitrary argumnets (alias sequence) +// * __FILE_FULL_PATH__ = compile time usage file +// * __FILE__ = compile time usage file (relative) +// * __LINE__ = compile time usage line number +// * __MODULE__ = compile time usage module +// * __FUNCTION__ = compile time usage function +// * __PRETTY_FUNCTION__ = compile time usage function (pretty) +// */ +// public void error(TextType...)(TextType segments, +// string c1 = __FILE_FULL_PATH__, +// string c2 = __FILE__, ulong c3 = __LINE__, +// string c4 = __MODULE__, string c5 = __FUNCTION__, +// string c6 = __PRETTY_FUNCTION__) +// { +// /* Build up the line information */ +// GoggaCompInfo compilationInfo = GoggaCompInfo(c1, c2, c3, c4, c5, c6); - /* Build up the line information */ - CompilationInfo compilationInfo = CompilationInfo(c1, c2, c3, c4, c5, c6); +// /** +// * Grab at compile-time all arguments and generate runtime code to add them to `components` +// */ +// string[] components = flatten(segments); - /* Set the line information in the context */ - defaultContext.setLineInfo(compilationInfo); +// /* Join all `components` into a single string */ +// string messageOut = join(components, " "); - /* Set the level to ERROR */ - defaultContext.setLevel(Level.ERROR); +// /* Call the log */ +// logc(defaultContext, messageOut, c1, c2, c3, c4, c5, c6); +// } - /** - * Grab at compile-time all arguments and generate runtime code to add them to `components` - */ - string[] components = flatten(segments); +// /** +// * Logs using the default context an arbitrary amount of arguments +// * specifically setting the context's level to INFO +// * +// * Params: +// * segments = the arbitrary argumnets (alias sequence) +// * __FILE_FULL_PATH__ = compile time usage file +// * __FILE__ = compile time usage file (relative) +// * __LINE__ = compile time usage line number +// * __MODULE__ = compile time usage module +// * __FUNCTION__ = compile time usage function +// * __PRETTY_FUNCTION__ = compile time usage function (pretty) +// */ +// public void info(TextType...)(TextType segments, +// string c1 = __FILE_FULL_PATH__, +// string c2 = __FILE__, ulong c3 = __LINE__, +// string c4 = __MODULE__, string c5 = __FUNCTION__, +// string c6 = __PRETTY_FUNCTION__) +// { +// /* Use the context `GoggaContext` */ +// GoggaContext defaultContext = new GoggaContext(); - /* Join all `components` into a single string */ - string messageOut = join(components, multiArgJoiner); +// /* Build up the line information */ +// CompilationInfo compilationInfo = CompilationInfo(c1, c2, c3, c4, c5, c6); - /* Call the log */ - logc(defaultContext, messageOut, c1, c2, c3, c4, c5, c6); - } +// /* Set the line information in the context */ +// defaultContext.setLineInfo(compilationInfo); - /** - * Logs using the default context an arbitrary amount of arguments - * specifically setting the context's level to INFO - * - * Params: - * segments = the arbitrary argumnets (alias sequence) - * __FILE_FULL_PATH__ = compile time usage file - * __FILE__ = compile time usage file (relative) - * __LINE__ = compile time usage line number - * __MODULE__ = compile time usage module - * __FUNCTION__ = compile time usage function - * __PRETTY_FUNCTION__ = compile time usage function (pretty) - */ - public void info(TextType...)(TextType segments, - string c1 = __FILE_FULL_PATH__, - string c2 = __FILE__, ulong c3 = __LINE__, - string c4 = __MODULE__, string c5 = __FUNCTION__, - string c6 = __PRETTY_FUNCTION__) - { - /* Use the context `GoggaContext` */ - GoggaContext defaultContext = new GoggaContext(); +// /* Set the level to INFO */ +// defaultContext.setLevel(Level.INFO); - /* Build up the line information */ - CompilationInfo compilationInfo = CompilationInfo(c1, c2, c3, c4, c5, c6); +// /** +// * Grab at compile-time all arguments and generate runtime code to add them to `components` +// */ +// string[] components = flatten(segments); - /* Set the line information in the context */ - defaultContext.setLineInfo(compilationInfo); +// /* Join all `components` into a single string */ +// string messageOut = join(components, multiArgJoiner); - /* Set the level to INFO */ - defaultContext.setLevel(Level.INFO); +// /* Call the log */ +// logc(defaultContext, messageOut, c1, c2, c3, c4, c5, c6); +// } - /** - * Grab at compile-time all arguments and generate runtime code to add them to `components` - */ - string[] components = flatten(segments); +// /** +// * Logs using the default context an arbitrary amount of arguments +// * specifically setting the context's level to WARN +// * +// * Params: +// * segments = the arbitrary argumnets (alias sequence) +// * __FILE_FULL_PATH__ = compile time usage file +// * __FILE__ = compile time usage file (relative) +// * __LINE__ = compile time usage line number +// * __MODULE__ = compile time usage module +// * __FUNCTION__ = compile time usage function +// * __PRETTY_FUNCTION__ = compile time usage function (pretty) +// */ +// public void warn(TextType...)(TextType segments, +// string c1 = __FILE_FULL_PATH__, +// string c2 = __FILE__, ulong c3 = __LINE__, +// string c4 = __MODULE__, string c5 = __FUNCTION__, +// string c6 = __PRETTY_FUNCTION__) +// { +// /* Use the context `GoggaContext` */ +// GoggaContext defaultContext = new GoggaContext(); - /* Join all `components` into a single string */ - string messageOut = join(components, multiArgJoiner); +// /* Build up the line information */ +// CompilationInfo compilationInfo = CompilationInfo(c1, c2, c3, c4, c5, c6); - /* Call the log */ - logc(defaultContext, messageOut, c1, c2, c3, c4, c5, c6); - } +// /* Set the line information in the context */ +// defaultContext.setLineInfo(compilationInfo); - /** - * Logs using the default context an arbitrary amount of arguments - * specifically setting the context's level to WARN - * - * Params: - * segments = the arbitrary argumnets (alias sequence) - * __FILE_FULL_PATH__ = compile time usage file - * __FILE__ = compile time usage file (relative) - * __LINE__ = compile time usage line number - * __MODULE__ = compile time usage module - * __FUNCTION__ = compile time usage function - * __PRETTY_FUNCTION__ = compile time usage function (pretty) - */ - public void warn(TextType...)(TextType segments, - string c1 = __FILE_FULL_PATH__, - string c2 = __FILE__, ulong c3 = __LINE__, - string c4 = __MODULE__, string c5 = __FUNCTION__, - string c6 = __PRETTY_FUNCTION__) - { - /* Use the context `GoggaContext` */ - GoggaContext defaultContext = new GoggaContext(); +// /* Set the level to WARN */ +// defaultContext.setLevel(Level.WARN); - /* Build up the line information */ - CompilationInfo compilationInfo = CompilationInfo(c1, c2, c3, c4, c5, c6); +// /** +// * Grab at compile-time all arguments and generate runtime code to add them to `components` +// */ +// string[] components = flatten(segments); - /* Set the line information in the context */ - defaultContext.setLineInfo(compilationInfo); +// /* Join all `components` into a single string */ +// string messageOut = join(components, multiArgJoiner); - /* Set the level to WARN */ - defaultContext.setLevel(Level.WARN); +// /* Call the log */ +// logc(defaultContext, messageOut, c1, c2, c3, c4, c5, c6); +// } - /** - * Grab at compile-time all arguments and generate runtime code to add them to `components` - */ - string[] components = flatten(segments); +// /** +// * Logs using the default context an arbitrary amount of arguments +// * specifically setting the context's level to DEBUG and will +// * only print if debugging is enabled +// * +// * Params: +// * segments = the arbitrary argumnets (alias sequence) +// * __FILE_FULL_PATH__ = compile time usage file +// * __FILE__ = compile time usage file (relative) +// * __LINE__ = compile time usage line number +// * __MODULE__ = compile time usage module +// * __FUNCTION__ = compile time usage function +// * __PRETTY_FUNCTION__ = compile time usage function (pretty) +// */ +// public void debug_(TextType...)(TextType segments, +// string c1 = __FILE_FULL_PATH__, +// string c2 = __FILE__, ulong c3 = __LINE__, +// string c4 = __MODULE__, string c5 = __FUNCTION__, +// string c6 = __PRETTY_FUNCTION__) +// { +// /* Only debug if debugging is enabled */ +// if(debugEnabled) +// { +// /* Use the context `GoggaContext` */ +// GoggaContext defaultContext = new GoggaContext(); - /* Join all `components` into a single string */ - string messageOut = join(components, multiArgJoiner); +// /* Build up the line information */ +// CompilationInfo compilationInfo = CompilationInfo(c1, c2, c3, c4, c5, c6); - /* Call the log */ - logc(defaultContext, messageOut, c1, c2, c3, c4, c5, c6); - } +// /* Set the line information in the context */ +// defaultContext.setLineInfo(compilationInfo); - /** - * Logs using the default context an arbitrary amount of arguments - * specifically setting the context's level to DEBUG and will - * only print if debugging is enabled - * - * Params: - * segments = the arbitrary argumnets (alias sequence) - * __FILE_FULL_PATH__ = compile time usage file - * __FILE__ = compile time usage file (relative) - * __LINE__ = compile time usage line number - * __MODULE__ = compile time usage module - * __FUNCTION__ = compile time usage function - * __PRETTY_FUNCTION__ = compile time usage function (pretty) - */ - public void debug_(TextType...)(TextType segments, - string c1 = __FILE_FULL_PATH__, - string c2 = __FILE__, ulong c3 = __LINE__, - string c4 = __MODULE__, string c5 = __FUNCTION__, - string c6 = __PRETTY_FUNCTION__) - { - /* Only debug if debugging is enabled */ - if(debugEnabled) - { - /* Use the context `GoggaContext` */ - GoggaContext defaultContext = new GoggaContext(); +// /* Set the level to DEBUG */ +// defaultContext.setLevel(Level.DEBUG); - /* Build up the line information */ - CompilationInfo compilationInfo = CompilationInfo(c1, c2, c3, c4, c5, c6); +// /** +// * Grab at compile-time all arguments and generate runtime code to add them to `components` +// */ +// string[] components = flatten(segments); - /* Set the line information in the context */ - defaultContext.setLineInfo(compilationInfo); +// /* Join all `components` into a single string */ +// string messageOut = join(components, multiArgJoiner); - /* Set the level to DEBUG */ - defaultContext.setLevel(Level.DEBUG); +// /* Call the log */ +// logc(defaultContext, messageOut, c1, c2, c3, c4, c5, c6); +// } +// } - /** - * Grab at compile-time all arguments and generate runtime code to add them to `components` - */ - string[] components = flatten(segments); + // /** + // * Alias for debug_ + // */ + // public alias dbg = debug_; - /* Join all `components` into a single string */ - string messageOut = join(components, multiArgJoiner); + // /** + // * Enables debug prints + // */ + // public void enableDebug() + // { + // this.debugEnabled = true; + // } - /* Call the log */ - logc(defaultContext, messageOut, c1, c2, c3, c4, c5, c6); - } - } + // /** + // * Disables debug prints + // */ + // public void disableDebug() + // { + // this.debugEnabled = false; + // } +// } - /** - * Alias for debug_ - */ - public alias dbg = debug_; +// version(unittest) +// { +// import std.stdio : writeln; +// } - /** - * Enables debug prints - */ - public void enableDebug() - { - this.debugEnabled = true; - } +// unittest +// { +// GoggaLogger gLogger = new GoggaLogger(); - /** - * Disables debug prints - */ - public void disableDebug() - { - this.debugEnabled = false; - } -} +// // Test the normal modes +// gLogger.info("This is an info message"); +// gLogger.warn("This is a warning message"); +// gLogger.error("This is an error message"); -version(unittest) -{ - import std.stdio : writeln; -} +// // We shouldn't see anything as debug is off +// gLogger.dbg("This is a debug which is hidden", 1); -unittest -{ - GoggaLogger gLogger = new GoggaLogger(); +// // Now enable debugging and you should see it +// gLogger.enableDebug(); +// gLogger.dbg("This is a VISIBLE debug", true); - // Test the normal modes - gLogger.info("This is an info message"); - gLogger.warn("This is a warning message"); - gLogger.error("This is an error message"); +// // Make space between unit tests +// writeln(); +// } - // We shouldn't see anything as debug is off - gLogger.dbg("This is a debug which is hidden", 1); +// unittest +// { +// GoggaLogger gLogger = new GoggaLogger(); +// gLogger.mode(GoggaMode.TwoKTwenty3); - // Now enable debugging and you should see it - gLogger.enableDebug(); - gLogger.dbg("This is a VISIBLE debug", true); +// // Test the normal modes +// gLogger.info("This is an info message"); +// gLogger.warn("This is a warning message"); +// gLogger.error("This is an error message"); - // Make space between unit tests - writeln(); -} +// // We shouldn't see anything as debug is off +// gLogger.dbg("This is a debug which is hidden", 1); -unittest -{ - GoggaLogger gLogger = new GoggaLogger(); - gLogger.mode(GoggaMode.TwoKTwenty3); +// // Now enable debugging and you should see it +// gLogger.enableDebug(); +// gLogger.dbg("This is a VISIBLE debug", true); - // Test the normal modes - gLogger.info("This is an info message"); - gLogger.warn("This is a warning message"); - gLogger.error("This is an error message"); +// // Make space between unit tests +// writeln(); +// } - // We shouldn't see anything as debug is off - gLogger.dbg("This is a debug which is hidden", 1); +// unittest +// { +// GoggaLogger gLogger = new GoggaLogger(); +// gLogger.mode(GoggaMode.SIMPLE); - // Now enable debugging and you should see it - gLogger.enableDebug(); - gLogger.dbg("This is a VISIBLE debug", true); +// // Test the normal modes +// gLogger.info("This is an info message"); +// gLogger.warn("This is a warning message"); +// gLogger.error("This is an error message"); - // Make space between unit tests - writeln(); -} +// // We shouldn't see anything as debug is off +// gLogger.dbg("This is a debug which is hidden", 1); -unittest -{ - GoggaLogger gLogger = new GoggaLogger(); - gLogger.mode(GoggaMode.SIMPLE); +// // Now enable debugging and you should see it +// gLogger.enableDebug(); +// gLogger.dbg("This is a VISIBLE debug", true); - // Test the normal modes - gLogger.info("This is an info message"); - gLogger.warn("This is a warning message"); - gLogger.error("This is an error message"); +// // Make space between unit tests +// writeln(); +// } - // We shouldn't see anything as debug is off - gLogger.dbg("This is a debug which is hidden", 1); +// unittest +// { +// GoggaLogger gLogger = new GoggaLogger(); +// gLogger.mode(GoggaMode.RUSTACEAN); - // Now enable debugging and you should see it - gLogger.enableDebug(); - gLogger.dbg("This is a VISIBLE debug", true); +// // Test the normal modes +// gLogger.info("This is an info message"); +// gLogger.warn("This is a warning message"); +// gLogger.error("This is an error message"); - // Make space between unit tests - writeln(); -} +// // We shouldn't see anything as debug is off +// gLogger.dbg("This is a debug which is hidden", 1); -unittest -{ - GoggaLogger gLogger = new GoggaLogger(); - gLogger.mode(GoggaMode.RUSTACEAN); +// // Now enable debugging and you should see it +// gLogger.enableDebug(); +// gLogger.dbg("This is a VISIBLE debug", true); - // Test the normal modes - gLogger.info("This is an info message"); - gLogger.warn("This is a warning message"); - gLogger.error("This is an error message"); +// // Make space between unit tests +// writeln(); +// } - // We shouldn't see anything as debug is off - gLogger.dbg("This is a debug which is hidden", 1); +// unittest +// { +// GoggaLogger gLogger = new GoggaLogger(); +// gLogger.mode(GoggaMode.RUSTACEAN_SIMPLE); - // Now enable debugging and you should see it - gLogger.enableDebug(); - gLogger.dbg("This is a VISIBLE debug", true); +// // Test the normal modes +// gLogger.info("This is an info message"); +// gLogger.warn("This is a warning message"); +// gLogger.error("This is an error message"); - // Make space between unit tests - writeln(); -} +// // We shouldn't see anything as debug is off +// gLogger.dbg("This is a debug which is hidden", 1); -unittest -{ - GoggaLogger gLogger = new GoggaLogger(); - gLogger.mode(GoggaMode.RUSTACEAN_SIMPLE); +// // Now enable debugging and you should see it +// gLogger.enableDebug(); +// gLogger.dbg("This is a VISIBLE debug", true); - // Test the normal modes - gLogger.info("This is an info message"); - gLogger.warn("This is a warning message"); - gLogger.error("This is an error message"); - - // We shouldn't see anything as debug is off - gLogger.dbg("This is a debug which is hidden", 1); - - // Now enable debugging and you should see it - gLogger.enableDebug(); - gLogger.dbg("This is a VISIBLE debug", true); - - // Make space between unit tests - writeln(); -} \ No newline at end of file +// // Make space between unit tests +// writeln(); +// } \ No newline at end of file