| 102 | } |
| 103 | |
| 104 | function output(type: LogType, msg: string, options: LogErrorOptions = {}) { |
| 105 | if (thresh >= LogLevels[type]) { |
| 106 | const method = type === 'info' ? 'log' : type |
| 107 | |
| 108 | if (options.error) { |
| 109 | loggedErrors.add(options.error) |
| 110 | } |
| 111 | if (canClearScreen) { |
| 112 | if (type === lastType && msg === lastMsg) { |
| 113 | sameCount++ |
| 114 | clear() |
| 115 | console[method]( |
| 116 | format(type, msg, options), |
| 117 | colors.yellow(`(x${sameCount + 1})`), |
| 118 | ) |
| 119 | } else { |
| 120 | sameCount = 0 |
| 121 | lastMsg = msg |
| 122 | lastType = type |
| 123 | if (options.clear) { |
| 124 | clear() |
| 125 | } |
| 126 | console[method](format(type, msg, options)) |
| 127 | } |
| 128 | } else { |
| 129 | console[method](format(type, msg, options)) |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | const warnedMessages = new Set<string>() |
| 135 | |