FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
librime-lua-script/lua/tools/debugtool.lua at main · shewer/librime-lua-script · GitHub
shewer
librime-lua-script
Repository navigation
Code
Issues
4
(4)
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
librime-lua-script
/
lua
/
tools
/
debugtool.lua
Copy path
More file actions
More file actions
Latest commit
History
History
History
50 lines (49 loc) · 1.32 KB
Breadcrumbs
librime-lua-script
/
lua
/
tools
/
debugtool.lua
Copy path
File metadata and controls
50 lines (49 loc) · 1.32 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!
/usr/bin/env lua
--
--
debugtool.lua
--
Copyright (C) 2021 Shewer Lu <shewer@gmail.com>
--
--
Distributed under terms of the MIT license.
--
--
puts(tag,...)
--
DEBUG --> log.error
--
WARN --> log.warning
--
INFO --> log.info
--
CONSOLE --> print
--
--
ex:
--
test.lua
--
--
local puts = require 'tools/debugtool'
--
--set tag D103 C102
--
local D103= DEBUG .. "103"
--
local C102= CONSOLE .. "102"
--
local C103= nil
--
--
--
puts(ERROR,__FILE__(),__LINE__(),__FUNC__(), 1, 2 , 3 )
--
--> log.error( "error" .. tran_msg(...))
--
--
puts(DEBUG,__FILE__(),__LINE__(),__FUNC__(), 1, 2 , 3 )
--
--> log.error( DEBUG .. tran_msg(...))
--
--
puts(D103,__FILE__(),__LINE__(),__FUNC__(), 1 2 3)
--
--> log.error("trace103" .. tran_msg(...)
--
--
puts(C102,__FILE__(),__LINE__(),__FUNC__(), 1 2 3)
--
--> print("console103" .. tran_msg(...)
--
--
puts(C103,__FILE__(),__LINE__(),__FUNC__(), 1 2 3)
--
--> pass
--
--
--
--
puts(DEBUG,__FILE__(),__LINE__(),__FUNC__() , ...)
--
puts(INFO,__FILE__(),__LINE__(),__FUNC__() , ...)
--
--
global variable
function
__FILE__
(
n
)
n
=
n
or
2
return
debug.getinfo
(
n
,
'
S
'
).
short_src
end
function
__LINE__
(
n
)
n
=
n
or
2
return
debug.getinfo
(
n
,
'
l
'
).
currentline
end
function
__FUNC__
(
n
)
n
=
n
or
2
return
debug.getinfo
(
n
,
'
n
'
).
name
end
local
ok
,
res
=
pcall
(
require
,
'
croissant.debugger
'
)
GD
=
ok
and
res
or
nil
Back
|
FazBrowse Home
|
New Git URL