Skip to content

Commit f7f88de

Browse files
author
Andrew Ferrier
committed
feat: Make uses stderr, JS uses console.debug - closes #48
1 parent 3e27d34 commit f7f88de

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

lua/debugprint/filetypes.lua

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
-- For most of these default configurations, we're aiming to log at a
2+
-- 'debug'-style level of logging. For more console-oriented languages (e.g.
3+
-- shell/python), we log to stderr, as this is often a standard way of producing
4+
-- output which isn't part of the main program. For others (e.g. JavaScript), we
5+
-- use a language-specific way, i.e. console.debug().
6+
--
7+
-- In general, we're trying to avoid the user of debugprint having to modify
8+
-- their imports or other libraries in order to use any of these statements.
9+
-- However, in a few cases, that might be needed. Any potential improvements to
10+
-- this welcome.
11+
112
local shell = {
213
left = '>&2 echo "',
314
right = '"',
@@ -10,14 +21,12 @@ local docker = vim.deepcopy(shell)
1021
docker.left = "RUN " .. docker.left
1122

1223
local js = {
13-
left = 'console.log("',
24+
left = 'console.debug("',
1425
right = '")',
1526
mid_var = '", ',
1627
right_var = ")",
1728
}
1829

19-
-- still printing to stdout: dart, lua, make, vim
20-
2130
return {
2231
["bash"] = shell,
2332
["c"] = {
@@ -66,7 +75,7 @@ return {
6675
right_var = "))",
6776
},
6877
["make"] = {
69-
left = '\t@echo "',
78+
left = '\t@echo >&2 "',
7079
right = '"',
7180
mid_var = '"$(',
7281
right_var = ")",

0 commit comments

Comments
 (0)