@jdeighan/coffee-utils 7.0.54 → 7.0.55
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 +8 -6
- package/src/debug_utils.js +8 -14
- package/src/log_utils.coffee +6 -0
- package/src/log_utils.js +5 -0
package/package.json
CHANGED
package/src/debug_utils.coffee
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
assert, undef, error, croak, warn, defined,
|
|
5
|
-
isString, isFunction, isBoolean,
|
|
5
|
+
isString, isFunction, isBoolean,
|
|
6
6
|
OL, escapeStr, isNumber, isArray, words, pass,
|
|
7
7
|
} from '@jdeighan/coffee-utils'
|
|
8
8
|
import {blockToArray} from '@jdeighan/coffee-utils/block'
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
getPrefix, addArrow, removeLastVbar,
|
|
14
14
|
} from '@jdeighan/coffee-utils/arrow'
|
|
15
15
|
import {
|
|
16
|
-
log, logItem, LOG, shortEnough,
|
|
16
|
+
log, logItem, LOG, shortEnough, dashes,
|
|
17
17
|
} from '@jdeighan/coffee-utils/log'
|
|
18
18
|
|
|
19
19
|
callStack = new CallStack()
|
|
@@ -73,16 +73,18 @@ export debug = (label, lObjects...) ->
|
|
|
73
73
|
switch type
|
|
74
74
|
when 'enter'
|
|
75
75
|
log label, {prefix}
|
|
76
|
+
prefix = removeLastVbar(prefix)
|
|
76
77
|
for obj,i in lObjects
|
|
77
78
|
if (i > 0)
|
|
78
|
-
log
|
|
79
|
-
logItem undef, obj, {prefix
|
|
79
|
+
log dashes(prefix)
|
|
80
|
+
logItem undef, obj, {prefix}
|
|
80
81
|
when 'return'
|
|
81
82
|
log label, {prefix: addArrow(prefix)}
|
|
83
|
+
prefix = removeLastVbar(prefix)
|
|
82
84
|
for obj,i in lObjects
|
|
83
85
|
if (i > 0)
|
|
84
|
-
log
|
|
85
|
-
logItem undef, obj, {prefix
|
|
86
|
+
log dashes(prefix)
|
|
87
|
+
logItem undef, obj, {prefix}
|
|
86
88
|
when 'string'
|
|
87
89
|
log label, {prefix}
|
|
88
90
|
when 'objects'
|
package/src/debug_utils.js
CHANGED
|
@@ -12,7 +12,6 @@ import {
|
|
|
12
12
|
isString,
|
|
13
13
|
isFunction,
|
|
14
14
|
isBoolean,
|
|
15
|
-
sep_dash,
|
|
16
15
|
OL,
|
|
17
16
|
escapeStr,
|
|
18
17
|
isNumber,
|
|
@@ -47,7 +46,8 @@ import {
|
|
|
47
46
|
log,
|
|
48
47
|
logItem,
|
|
49
48
|
LOG,
|
|
50
|
-
shortEnough
|
|
49
|
+
shortEnough,
|
|
50
|
+
dashes
|
|
51
51
|
} from '@jdeighan/coffee-utils/log';
|
|
52
52
|
|
|
53
53
|
callStack = new CallStack();
|
|
@@ -107,32 +107,26 @@ export var debug = function(label, ...lObjects) {
|
|
|
107
107
|
switch (type) {
|
|
108
108
|
case 'enter':
|
|
109
109
|
log(label, {prefix});
|
|
110
|
+
prefix = removeLastVbar(prefix);
|
|
110
111
|
for (i = j = 0, len1 = lObjects.length; j < len1; i = ++j) {
|
|
111
112
|
obj = lObjects[i];
|
|
112
113
|
if (i > 0) {
|
|
113
|
-
log(
|
|
114
|
-
prefix: removeLastVbar(prefix)
|
|
115
|
-
});
|
|
114
|
+
log(dashes(prefix));
|
|
116
115
|
}
|
|
117
|
-
logItem(undef, obj, {
|
|
118
|
-
prefix: removeLastVbar(prefix)
|
|
119
|
-
});
|
|
116
|
+
logItem(undef, obj, {prefix});
|
|
120
117
|
}
|
|
121
118
|
break;
|
|
122
119
|
case 'return':
|
|
123
120
|
log(label, {
|
|
124
121
|
prefix: addArrow(prefix)
|
|
125
122
|
});
|
|
123
|
+
prefix = removeLastVbar(prefix);
|
|
126
124
|
for (i = k = 0, len2 = lObjects.length; k < len2; i = ++k) {
|
|
127
125
|
obj = lObjects[i];
|
|
128
126
|
if (i > 0) {
|
|
129
|
-
log(
|
|
130
|
-
prefix: removeLastVbar(prefix)
|
|
131
|
-
});
|
|
127
|
+
log(dashes(prefix));
|
|
132
128
|
}
|
|
133
|
-
logItem(undef, obj, {
|
|
134
|
-
prefix: removeLastVbar(prefix)
|
|
135
|
-
});
|
|
129
|
+
logItem(undef, obj, {prefix});
|
|
136
130
|
}
|
|
137
131
|
break;
|
|
138
132
|
case 'string':
|
package/src/log_utils.coffee
CHANGED
|
@@ -20,6 +20,12 @@ fourSpaces = ' '
|
|
|
20
20
|
|
|
21
21
|
# ---------------------------------------------------------------------------
|
|
22
22
|
|
|
23
|
+
export dashes = (prefix, totalLen=64, ch='-') ->
|
|
24
|
+
|
|
25
|
+
return prefix + ch.repeat(totalLen - prefix.length)
|
|
26
|
+
|
|
27
|
+
# ---------------------------------------------------------------------------
|
|
28
|
+
|
|
23
29
|
export debugLog = (flag=true) ->
|
|
24
30
|
|
|
25
31
|
doDebugLog = flag
|
package/src/log_utils.js
CHANGED
|
@@ -39,6 +39,11 @@ export var stringify = undef;
|
|
|
39
39
|
|
|
40
40
|
fourSpaces = ' ';
|
|
41
41
|
|
|
42
|
+
// ---------------------------------------------------------------------------
|
|
43
|
+
export var dashes = function(prefix, totalLen = 64, ch = '-') {
|
|
44
|
+
return prefix + ch.repeat(totalLen - prefix.length);
|
|
45
|
+
};
|
|
46
|
+
|
|
42
47
|
// ---------------------------------------------------------------------------
|
|
43
48
|
export var debugLog = function(flag = true) {
|
|
44
49
|
doDebugLog = flag;
|