From 5a503fb14cafff2405d6af65ebb1e3ca2b7db28f Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Wed, 1 Mar 2023 09:14:14 +0200 Subject: [PATCH] Context - Added new Context class for future version --- source/dlog/context.d | 48 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 source/dlog/context.d diff --git a/source/dlog/context.d b/source/dlog/context.d new file mode 100644 index 0000000..48c5f5e --- /dev/null +++ b/source/dlog/context.d @@ -0,0 +1,48 @@ +module dlog.context; + +/** + * Context that is passed in with the call to log + */ +public class Context +{ + private CompilationInfo lineInfo; + + this() + { + + } + + public final void setLineInfo(CompilationInfo lineInfo) + { + this.lineInfo = lineInfo; + } + + public final CompilationInfo getLineInfo() + { + return lineInfo; + } +} + +/** + * Information obtained during compilation time (if any) + */ +public struct CompilationInfo +{ + private string fullFilePath; + private string file; + private ulong line; + private string moduleName; + private string functionName; + private string prettyFunctionName; + + this(string fullFilePath, string file, ulong line, string moduleName, string functionName, string prettyFunctionName) + { + this.fullFilePath = fullFilePath; + this.file = file; + this.line = line; + this.moduleName = moduleName; + this.functionName = functionName; + this.prettyFunctionName = prettyFunctionName; + } +} +