Skip to content

Commit

Permalink
Merge 5ca3760 into ef78a15
Browse files Browse the repository at this point in the history
  • Loading branch information
deavmi committed Apr 11, 2024
2 parents ef78a15 + 5ca3760 commit 4bbc656
Show file tree
Hide file tree
Showing 15 changed files with 81 additions and 14 deletions.
2 changes: 1 addition & 1 deletion dub.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
],
"copyright": "Copyright © 2021-2023, Tristan B. Kildaire",
"dependencies": {
"gogga": "~>0.1.0",
"gogga": ">=3.1.1",
"jcli": "0.25.0-beta.3",
"niknaks": ">=0.9.8"
},
Expand Down
2 changes: 1 addition & 1 deletion source/tlang/commandline/commands.d
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import tlang.compiler.lexer.kinds.basic : BasicLexer;
import tlang.compiler.lexer.core;
import tlang.compiler.parsing.core : Parser;
import tlang.compiler.typecheck.core : TypeChecker;
import gogga;
import tlang.misc.logging;
import tlang.compiler.core : Compiler, beginCompilation;
import tlang.compiler.configuration : ConfigEntry;
import std.conv : to;
Expand Down
2 changes: 1 addition & 1 deletion source/tlang/compiler/codegen/emit/dgen.d
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import std.stdio;
import std.file;
import std.conv : to;
import std.string : cmp;
import gogga;
import tlang.misc.logging;
import std.range : walkLength;
import std.string : wrap;
import std.process : spawnProcess, Pid, ProcessException, wait;
Expand Down
2 changes: 1 addition & 1 deletion source/tlang/compiler/core.d
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module tlang.compiler.core;

import gogga;
import tlang.misc.logging;
import std.conv : to;
import tlang.compiler.lexer.core;
import tlang.compiler.lexer.kinds.basic : BasicLexer;
Expand Down
2 changes: 1 addition & 1 deletion source/tlang/compiler/lexer/kinds/basic.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module tlang.compiler.lexer.kinds.basic;

import std.container.slist;
import std.string : replace;
import gogga;
import tlang.misc.logging;
import std.conv : to;
import std.ascii : isDigit, isAlpha, isWhite;
import tlang.compiler.lexer.core;
Expand Down
2 changes: 1 addition & 1 deletion source/tlang/compiler/modman/modman.d
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module tlang.compiler.modman.modman;

import gogga;
import tlang.misc.logging;
import std.file : isDir;
import std.path : isAbsolute;

Expand Down
2 changes: 1 addition & 1 deletion source/tlang/compiler/parsing/core.d
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module tlang.compiler.parsing.core;

import gogga;
import tlang.misc.logging;
import std.conv : to, ConvException;
import std.string : isNumeric, cmp;
import tlang.compiler.symbols.check;
Expand Down
2 changes: 1 addition & 1 deletion source/tlang/compiler/symbols/check.d
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import std.conv : to;
import std.string : isNumeric, cmp;
import std.algorithm.searching : canFind;
import misc.utils;
import gogga;
import tlang.misc.logging;

/**
* All allowed symbols
Expand Down
2 changes: 1 addition & 1 deletion source/tlang/compiler/symbols/data.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import std.conv : to;
import tlang.compiler.typecheck.dependency.core : Context;

// For debug printing
import gogga;
import tlang.misc.logging;

// AST manipulation interfaces
import tlang.compiler.symbols.mcro : MStatementSearchable, MStatementReplaceable, MCloneable;
Expand Down
2 changes: 1 addition & 1 deletion source/tlang/compiler/symbols/typing/builtins.d
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module tlang.compiler.symbols.typing.builtins;

import tlang.compiler.symbols.typing.core;
import std.string : cmp, indexOf, lastIndexOf;
import gogga;
import tlang.misc.logging;
import tlang.compiler.typecheck.core;
import std.conv : to;
import tlang.compiler.symbols.data : Container;
Expand Down
2 changes: 1 addition & 1 deletion source/tlang/compiler/typecheck/core.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import tlang.compiler.symbols.data;
import std.conv : to, ConvException;
import std.string;
import std.stdio;
import gogga;
import tlang.misc.logging;
import tlang.compiler.parsing.core;
import tlang.compiler.typecheck.resolution;
import tlang.compiler.typecheck.exceptions;
Expand Down
2 changes: 1 addition & 1 deletion source/tlang/compiler/typecheck/dependency/core.d
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import tlang.compiler.symbols.data;
import std.conv : to;
import std.string;
import std.stdio;
import gogga;
import tlang.misc.logging;
import tlang.compiler.parsing.core;
import tlang.compiler.typecheck.resolution;
import tlang.compiler.typecheck.exceptions;
Expand Down
2 changes: 1 addition & 1 deletion source/tlang/compiler/typecheck/meta.d
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import tlang.compiler.symbols.typing.core;
import tlang.compiler.symbols.containers : Container;
import tlang.compiler.symbols.mcro;
import tlang.compiler.typecheck.core;
import gogga;
import tlang.misc.logging;
import std.conv : to;
import tlang.compiler.configuration;

Expand Down
2 changes: 1 addition & 1 deletion source/tlang/compiler/typecheck/resolution.d
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module tlang.compiler.typecheck.resolution;

import tlang.compiler.typecheck.core;
import gogga;
import tlang.misc.logging;
import tlang.compiler.symbols.data;
import std.string;
import std.conv : to;
Expand Down
67 changes: 67 additions & 0 deletions source/tlang/misc/logging.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* Logging routines
*
* Authors: Tristan Brice Velloza Kildaire (deavmi)
*/
module tlang.misc.logging;

import gogga;
import gogga.extras;

/**
* The logger instance
* shared amongst a single
* thread (TLS)
*/
private GoggaLogger logger;

/**
* Initializes a logger instance
* per thread (TLS)
*/
static this()
{
logger = new GoggaLogger();
logger.mode(GoggaMode.RUSTACEAN);

import dlog.basic : Level;
logger.setLevel(Level.DEBUG);

import dlog.basic : FileHandler;
import std.stdio : stdout;
logger.addHandler(new FileHandler(stdout));
}

// Bring in helper methods
mixin LoggingFuncs!(logger);


// TODO: Remove this
public enum DebugType
{
INFO,
WARNING,
ERROR,
DEBUG
}

// TODO: Change to actually use error, etc. directkly on GoggaLogger
public void gprintln(messageT)(messageT message, DebugType debugType = DebugType.INFO)
{
if(debugType == DebugType.DEBUG)
{
logger.dbg(message);
}
else if(debugType == DebugType.INFO)
{
logger.info(message);
}
else if(debugType == DebugType.WARNING)
{
logger.warn(message);
}
else
{
logger.error(message);
}
}

0 comments on commit 4bbc656

Please sign in to comment.