@jdeighan/coffee-utils 7.0.53 → 7.0.54

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@jdeighan/coffee-utils",
3
3
  "type": "module",
4
- "version": "7.0.53",
4
+ "version": "7.0.54",
5
5
  "description": "A set of utility functions for CoffeeScript",
6
6
  "main": "coffee_utils.js",
7
7
  "exports": {
@@ -160,5 +160,5 @@ export class CallStack
160
160
  LOG " <EMPTY>"
161
161
  else
162
162
  for item, i in @lStack
163
- LOG " #{i}: #{JSON.stringify(item)}"
163
+ LOG " #{i}: #{item.fullName} #{item.isLogged}"
164
164
  return
package/src/call_stack.js CHANGED
@@ -168,7 +168,7 @@ export var CallStack = class CallStack {
168
168
  ref = this.lStack;
169
169
  for (i = j = 0, len = ref.length; j < len; i = ++j) {
170
170
  item = ref[i];
171
- LOG(` ${i}: ${JSON.stringify(item)}`);
171
+ LOG(` ${i}: ${item.fullName} ${item.isLogged}`);
172
172
  }
173
173
  }
174
174
  }
@@ -95,7 +95,7 @@ export debug = (label, lObjects...) ->
95
95
  for obj in lObjects
96
96
  logItem undef, obj, {prefix}
97
97
 
98
- if (type == 'enter') && doLog
98
+ if (type == 'enter') && doLog && (label.indexOf('call') == -1)
99
99
  callStack.logCurFunc()
100
100
  else if (type == 'return')
101
101
  callStack.returnFrom funcName
@@ -119,20 +119,25 @@ export stdShouldLog = (label, type, funcName, stack) ->
119
119
  else
120
120
  assert funcName == undef, "func name #{OL(funcName)} not undef"
121
121
  assert stack instanceof CallStack, "not a call stack object"
122
+
122
123
  if doDebugDebug
123
124
  LOG "stdShouldLog(#{OL(label)}, #{OL(type)}, #{OL(funcName)}, stack)"
124
125
  LOG "stack", stack
125
126
  LOG "lFuncList", lFuncList
127
+
126
128
  switch type
127
129
  when 'enter'
128
130
  if funcMatch(stack, lFuncList)
129
131
  return label
130
132
 
131
- # --- As a special case, if we enter a function where we will not
132
- # be logging, but we were logging in the calling function,
133
- # we'll log out the call itself
134
- else if stack.isLoggingPrev()
135
- return label.replace('enter', 'call')
133
+ else
134
+ # --- As a special case, if we enter a function where we will not
135
+ # be logging, but we were logging in the calling function,
136
+ # we'll log out the call itself
137
+
138
+ prevLogged = stack.isLoggingPrev()
139
+ if prevLogged
140
+ return label.replace('enter', 'call')
136
141
  else
137
142
  if funcMatch(stack, lFuncList)
138
143
  return label
@@ -153,7 +153,7 @@ export var debug = function(label, ...lObjects) {
153
153
  }
154
154
  }
155
155
  }
156
- if ((type === 'enter') && doLog) {
156
+ if ((type === 'enter') && doLog && (label.indexOf('call') === -1)) {
157
157
  callStack.logCurFunc();
158
158
  } else if (type === 'return') {
159
159
  callStack.returnFrom(funcName);
@@ -164,6 +164,7 @@ export var debug = function(label, ...lObjects) {
164
164
 
165
165
  // ---------------------------------------------------------------------------
166
166
  export var stdShouldLog = function(label, type, funcName, stack) {
167
+ var prevLogged;
167
168
  // --- if type is 'enter', then funcName won't be on the stack yet
168
169
  // returns the (possibly modified) label to log
169
170
 
@@ -187,11 +188,14 @@ export var stdShouldLog = function(label, type, funcName, stack) {
187
188
  case 'enter':
188
189
  if (funcMatch(stack, lFuncList)) {
189
190
  return label;
190
- // --- As a special case, if we enter a function where we will not
191
- // be logging, but we were logging in the calling function,
192
- // we'll log out the call itself
193
- } else if (stack.isLoggingPrev()) {
194
- return label.replace('enter', 'call');
191
+ } else {
192
+ // --- As a special case, if we enter a function where we will not
193
+ // be logging, but we were logging in the calling function,
194
+ // we'll log out the call itself
195
+ prevLogged = stack.isLoggingPrev();
196
+ if (prevLogged) {
197
+ return label.replace('enter', 'call');
198
+ }
195
199
  }
196
200
  break;
197
201
  default: