@jdeighan/coffee-utils 7.0.55 → 7.0.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/debug_utils.coffee +9 -6
- package/src/debug_utils.js +9 -7
package/package.json
CHANGED
package/src/debug_utils.coffee
CHANGED
@@ -38,6 +38,9 @@ export debug = (label, lObjects...) ->
|
|
38
38
|
LOG "debug(): type = #{OL(type)}"
|
39
39
|
LOG "debug(): funcName = #{OL(funcName)}"
|
40
40
|
|
41
|
+
# --- function shouldLog() returns the (possibly modified) label
|
42
|
+
# if we should log this, else it returns undef
|
43
|
+
|
41
44
|
switch type
|
42
45
|
when 'enter'
|
43
46
|
callStack.enter funcName
|
@@ -64,27 +67,27 @@ export debug = (label, lObjects...) ->
|
|
64
67
|
if doLog
|
65
68
|
level = callStack.getLevel()
|
66
69
|
prefix = getPrefix(level)
|
70
|
+
itemPrefix = removeLastVbar(prefix)
|
67
71
|
|
68
72
|
if doDebugDebug
|
69
73
|
LOG "callStack", callStack
|
70
74
|
LOG "level = #{OL(level)}"
|
71
75
|
LOG "prefix = #{OL(prefix)}"
|
76
|
+
LOG "itemPrefix = #{OL(itemPrefix)}"
|
72
77
|
|
73
78
|
switch type
|
74
79
|
when 'enter'
|
75
80
|
log label, {prefix}
|
76
|
-
prefix = removeLastVbar(prefix)
|
77
81
|
for obj,i in lObjects
|
78
82
|
if (i > 0)
|
79
|
-
log dashes(
|
80
|
-
logItem undef, obj, {
|
83
|
+
log dashes(itemPrefix, 40)
|
84
|
+
logItem undef, obj, {itemPrefix}
|
81
85
|
when 'return'
|
82
86
|
log label, {prefix: addArrow(prefix)}
|
83
|
-
prefix = removeLastVbar(prefix)
|
84
87
|
for obj,i in lObjects
|
85
88
|
if (i > 0)
|
86
|
-
log dashes(
|
87
|
-
logItem undef, obj, {
|
89
|
+
log dashes(itemPrefix, 40)
|
90
|
+
logItem undef, obj, {itemPrefix}
|
88
91
|
when 'string'
|
89
92
|
log label, {prefix}
|
90
93
|
when 'objects'
|
package/src/debug_utils.js
CHANGED
@@ -60,7 +60,7 @@ export var lFuncList = [];
|
|
60
60
|
|
61
61
|
// ---------------------------------------------------------------------------
|
62
62
|
export var debug = function(label, ...lObjects) {
|
63
|
-
var doLog, funcName, i, j, k, l, len1, len2, len3, level, nObjects, obj, prefix, type;
|
63
|
+
var doLog, funcName, i, itemPrefix, j, k, l, len1, len2, len3, level, nObjects, obj, prefix, type;
|
64
64
|
assert(isString(label), `1st arg ${OL(label)} should be a string`);
|
65
65
|
// --- We want to allow objects to be undef. Therefore, we need to
|
66
66
|
// distinguish between 1 arg sent vs. 2 or more args sent
|
@@ -71,6 +71,8 @@ export var debug = function(label, ...lObjects) {
|
|
71
71
|
LOG(`debug(): type = ${OL(type)}`);
|
72
72
|
LOG(`debug(): funcName = ${OL(funcName)}`);
|
73
73
|
}
|
74
|
+
// --- function shouldLog() returns the (possibly modified) label
|
75
|
+
// if we should log this, else it returns undef
|
74
76
|
switch (type) {
|
75
77
|
case 'enter':
|
76
78
|
callStack.enter(funcName);
|
@@ -99,34 +101,34 @@ export var debug = function(label, ...lObjects) {
|
|
99
101
|
if (doLog) {
|
100
102
|
level = callStack.getLevel();
|
101
103
|
prefix = getPrefix(level);
|
104
|
+
itemPrefix = removeLastVbar(prefix);
|
102
105
|
if (doDebugDebug) {
|
103
106
|
LOG("callStack", callStack);
|
104
107
|
LOG(`level = ${OL(level)}`);
|
105
108
|
LOG(`prefix = ${OL(prefix)}`);
|
109
|
+
LOG(`itemPrefix = ${OL(itemPrefix)}`);
|
106
110
|
}
|
107
111
|
switch (type) {
|
108
112
|
case 'enter':
|
109
113
|
log(label, {prefix});
|
110
|
-
prefix = removeLastVbar(prefix);
|
111
114
|
for (i = j = 0, len1 = lObjects.length; j < len1; i = ++j) {
|
112
115
|
obj = lObjects[i];
|
113
116
|
if (i > 0) {
|
114
|
-
log(dashes(
|
117
|
+
log(dashes(itemPrefix, 40));
|
115
118
|
}
|
116
|
-
logItem(undef, obj, {
|
119
|
+
logItem(undef, obj, {itemPrefix});
|
117
120
|
}
|
118
121
|
break;
|
119
122
|
case 'return':
|
120
123
|
log(label, {
|
121
124
|
prefix: addArrow(prefix)
|
122
125
|
});
|
123
|
-
prefix = removeLastVbar(prefix);
|
124
126
|
for (i = k = 0, len2 = lObjects.length; k < len2; i = ++k) {
|
125
127
|
obj = lObjects[i];
|
126
128
|
if (i > 0) {
|
127
|
-
log(dashes(
|
129
|
+
log(dashes(itemPrefix, 40));
|
128
130
|
}
|
129
|
-
logItem(undef, obj, {
|
131
|
+
logItem(undef, obj, {itemPrefix});
|
130
132
|
}
|
131
133
|
break;
|
132
134
|
case 'string':
|