From ca5b87fed36aa9275446bf25c82f11b7d4359b39 Mon Sep 17 00:00:00 2001 From: Sebastian Kulesz Date: Tue, 17 Dec 2013 03:47:00 +0000 Subject: [PATCH] [GB.LOGGING] * BUG: Fix the detection of the call location. git-svn-id: svn://localhost/gambas/trunk@6010 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- comp/src/gb.logging/.src/Formatter.module | 14 ++++++++++---- comp/src/gb.logging/.src/MTest.module | 2 +- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/comp/src/gb.logging/.src/Formatter.module b/comp/src/gb.logging/.src/Formatter.module index 734501bd2..7e6f9f20b 100644 --- a/comp/src/gb.logging/.src/Formatter.module +++ b/comp/src/gb.logging/.src/Formatter.module @@ -6,25 +6,31 @@ Export Private Function GetCallLocation() As String - Return System.Backtrace[3] + Dim iCount As Integer = 3 + + While System.Backtrace[iCount] Begins "Logger" + Inc iCount + Wend + + Return System.Backtrace[iCount] End Private Function GetCallFile() As String - Return Split(System.Backtrace[3], ".")[0] + Return Split(GetCallLocation(), ".")[0] End Private Function GetCallFunction() As String - Return Split(System.Backtrace[3], ".")[1] + Return Split(GetCallLocation(), ".")[1] End Private Function GetCallLine() As String - Return Split(System.Backtrace[3], ".")[2] + Return Split(GetCallLocation(), ".")[2] End diff --git a/comp/src/gb.logging/.src/MTest.module b/comp/src/gb.logging/.src/MTest.module index dd9a7d663..bfd9cbd6d 100644 --- a/comp/src/gb.logging/.src/MTest.module +++ b/comp/src/gb.logging/.src/MTest.module @@ -4,7 +4,7 @@ Public Sub Main() Dim a As Logger - a = New Logger '(Logger.Debug, Logger.DefaultFormat, User.Home) + a = New Logger(Logger.Debug, "[$(now)] [$(levelname)] [$(callFunction)] $(message)") a.Begin()