From 05df5081dff5d242873ad430c1132fb588c715ea Mon Sep 17 00:00:00 2001 From: s-ol Date: Sat, 11 Apr 2020 09:47:24 +0200 Subject: remove source files in log (traceback format isn't portable) --- docs/guide.md | 4 ++-- logger.moon | 11 +++-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/docs/guide.md b/docs/guide.md index 4f3b75b..f9fb3f5 100644 --- a/docs/guide.md +++ b/docs/guide.md @@ -67,7 +67,7 @@ To run the copilot, open a shell and navigate into the repository. You can now run the `hello.alv` example script using the following command: $ moon init.moon hello.alv - [copilot.moon:76 ] hello.alv changed at 1585138092 + hello.alv changed at 1585138092 hello world! hello @@ -87,7 +87,7 @@ it onto the `copilot.bat` file in the folder, or by running the following command from the main directory in `cmd.exe`: C:\…\alive>copilot.bat hello.alv - [copilot.moon:76 ] hello.alv changed at 1585138092 + hello.alv changed at 1585138092 hello world! hello diff --git a/logger.moon b/logger.moon index b187a95..cd41cc8 100644 --- a/logger.moon +++ b/logger.moon @@ -14,23 +14,18 @@ class Logger mklog = (max_level) -> new: (level='log') => @level = levels[level] or level - @prefix = ' ' + @prefix = '' for name, level in pairs levels @[name] = (first, ...) => return unless @level <= level where = debug.traceback '', 2 - line = where\match '^.-\n%s+([%w:/%.]+): ' - line = (line\match '[%./]*(.*)') or line - line = (line\match '^core/(.*)') or line - line ..= string.rep ' ', 20-#line - if level == levels.error or @level == levels.debug - print "[#{line}]#{@prefix}#{first}", ... + print @prefix .. first, ... print where else - print "[#{line}]#{@prefix}#{first}", ... + print @prefix .. first, ... if level == levels.print @push = (fn, ...) => fn ... -- cgit v1.2.3