Skip to content

Commit

Permalink
Reduce info logs to a minimum
Browse files Browse the repository at this point in the history
  • Loading branch information
ZzAve committed Jan 24, 2025
1 parent 4066eda commit a9d9819
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ private enum class Stage {
TOKENIZED, PARSED, VALIDATED, EMITTED;

fun log(it: Any): HasLogger.() -> Unit = {
logger.info("********** $name **********\n$it\n########## $name ##########")
logger.debug("********** $name **********\n$it\n########## $name ##########")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ abstract class Emitter(

open fun emit(ast: AST): List<Emitted> = ast
.map {
logger.info("Emitting Node $it")
logger.info(
"Emitting Node ${
when (it) {
is Definition -> it.emitName()
}
}"
)
when (it) {
is Type -> Emitted(it.emitName(), emit(it, ast))
is Endpoint -> Emitted(it.emitName(), emit(it))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import community.flock.wirespec.compiler.utils.Logger
typealias AST = List<Node>

abstract class AbstractParser(protected val logger: Logger) {
protected fun Token.log() = logger.info("Parsing $type at line ${coordinates.line} position ${coordinates.position}")
protected fun Token.log() = logger.debug("Parsing $type at line ${coordinates.line} position ${coordinates.position}")
}

class Parser(logger: Logger) : AbstractParser(logger) {
Expand Down

0 comments on commit a9d9819

Please sign in to comment.