From 01dd603bd5f77230edc39d2ce8b17bb322a18106 Mon Sep 17 00:00:00 2001 From: Lucien Greathouse Date: Sun, 30 Dec 2018 21:25:40 -0800 Subject: [PATCH] Vertically align output for monospace consoles --- plugin/src/Logging.lua | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/plugin/src/Logging.lua b/plugin/src/Logging.lua index 30c54c78..c57130b5 100644 --- a/plugin/src/Logging.lua +++ b/plugin/src/Logging.lua @@ -26,25 +26,29 @@ local function addTags(tag, message) return tag .. message:gsub("\n", "\n" .. tag) end +local INFO_TAG = (" "):rep(15) .. "[Rojo-Info] " +local TRACE_TAG = (" "):rep(15) .. "[Rojo-Trace] " +local WARN_TAG = "[Rojo-Warn] " + local Log = {} Log.Level = Level function Log.trace(template, ...) if getLogLevel() >= Level.Trace then - print(addTags("[Rojo-Trace] ", string.format(template, ...))) + print(addTags(TRACE_TAG, string.format(template, ...))) end end function Log.info(template, ...) if getLogLevel() >= Level.Info then - print(addTags("[Rojo-Info] ", string.format(template, ...))) + print(addTags(INFO_TAG, string.format(template, ...))) end end function Log.warn(template, ...) if getLogLevel() >= Level.Warning then - warn(addTags("[Rojo-Warn] ", string.format(template, ...))) + warn(addTags(WARN_TAG, string.format(template, ...))) end end