3
' Copyright(C) 2011-2014, Michał Głowienka aka eloaders <eloaders@linux.pl>
5
' This program is free software; you can redistribute it and/or modify
6
' it under the terms of the GNU General Public License as published by
7
' the Free Software Foundation; either version 3 of the License, or
8
' (at your option) any later version.
10
' This program is distributed in the hope that it will be useful,
11
' but WITHOUT ANY WARRANTY; without even the implied warranty of
12
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
' GNU General Public License for more details.
15
' You should have received a copy of the GNU General Public License
16
' along with this program. If not, see <http://www.gnu.org/licenses/>.
18
Private Function GetCallLocation() As String
20
Return System.Backtrace[3]
24
Private Function GetCallFile() As String
26
Return Split(System.Backtrace[3], ".")[0]
30
Private Function GetCallFunction() As String
32
Return Split(System.Backtrace[3], ".")[1]
36
Private Function GetCallLine() As String
38
Return Split(System.Backtrace[3], ".")[2]
43
Public Function _call(sMessage As String, sFormat As String, iLevel As Integer) As String
47
If String.InStr(sFormat, "$(message)") > 0 Then
48
sFormat = Replace$(sFormat, "$(message)", sMessage)
51
If String.InStr(sFormat, "$(callLocation)") > 0 Then
52
sFormat = Replace$(sFormat, "$(callLocation)", GetCallLocation())
55
If String.InStr(sFormat, "$(callLine)") > 0 Then
56
sFormat = Replace$(sFormat, "$(callLine)", GetCallLine())
59
If String.InStr(sFormat, "$(callFile)") > 0 Then
60
sFormat = Replace$(sFormat, "$(callFile)", GetCallFile())
63
If String.InStr(sFormat, "$(callFunction)") > 0 Then
64
sFormat = Replace$(sFormat, "$(callFunction)", GetCallFunction())
67
If String.InStr(sFormat, "$(now)") > 0 Then
68
sFormat = Replace$(sFormat, "$(now)", CStr(Now))
71
If String.InStr(sFormat, "$(date)") > 0 Then
72
sFormat = Replace$(sFormat, "$(date)", CStr(Date(Now)))
75
If String.InStr(sFormat, "$(time)") > 0 Then
76
sFormat = Replace$(sFormat, "$(time)", CStr(Time(Now)))
79
If String.InStr(sFormat, "$(ptimer)") > 0 Then
80
sFormat = Replace$(sFormat, "$(ptimer)", CStr(Timer))
83
If String.InStr(sFormat, "$(ptimerint)") > 0 Then
84
sFormat = Replace$(sFormat, "$(ptimerint)", CStr(Int(Timer)))
87
If String.InStr(sFormat, "$(levelno)") > 0 Then
88
sFormat = Replace$(sFormat, "$(levelno)", CStr(iLevel))
91
If String.InStr(sFormat, "$(levelname)") > 0 Then
111
sFormat = Replace$(sFormat, "$(levelname)", sName)
115
If String.InStr(sFormat, "$(version)") > 0 Then
116
sFormat = Replace$(sFormat, "$(version)", Application.Version)
119
If String.InStr(sFormat, "$(gbversion)") > 0 Then
120
sFormat = Replace$(sFormat, "$(gbversion)", System.FullVersion)
123
If String.InStr(sFormat, "$(host)") > 0 Then
124
sFormat = Replace$(sFormat, "$(host)", System.Host)
127
If String.InStr(sFormat, "$(pid)") > 0 Then
128
sFormat = Replace$(sFormat, "$(pid)", CStr(Application.Id))