standard-log 8.0.0 → 9.0.1

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.
Files changed (614) hide show
  1. package/README.md +57 -133
  2. package/{esm/console/createConsoleLogReporter.d.ts → cjs/console.d.ts} +5 -5
  3. package/cjs/console.d.ts.map +1 -0
  4. package/cjs/console.js +76 -0
  5. package/cjs/console.js.map +1 -0
  6. package/cjs/console.spec.d.ts +2 -0
  7. package/cjs/console.spec.d.ts.map +1 -0
  8. package/cjs/{console/createConsoleLogReporter.spec.js → console.spec.js} +50 -55
  9. package/cjs/console.spec.js.map +1 -0
  10. package/cjs/errors.d.ts +1 -11
  11. package/cjs/errors.d.ts.map +1 -1
  12. package/cjs/errors.js +3 -45
  13. package/cjs/errors.js.map +1 -1
  14. package/cjs/formatter.d.ts +6 -0
  15. package/cjs/formatter.d.ts.map +1 -0
  16. package/cjs/formatter.js +46 -0
  17. package/cjs/formatter.js.map +1 -0
  18. package/cjs/formatter.spec.d.ts +2 -0
  19. package/cjs/formatter.spec.d.ts.map +1 -0
  20. package/cjs/formatter.spec.js +32 -0
  21. package/cjs/formatter.spec.js.map +1 -0
  22. package/cjs/index.d.ts +5 -14
  23. package/cjs/index.d.ts.map +1 -1
  24. package/cjs/index.js +5 -14
  25. package/cjs/index.js.map +1 -1
  26. package/cjs/logLevels.d.ts +60 -0
  27. package/cjs/logLevels.d.ts.map +1 -0
  28. package/cjs/logLevels.js +87 -0
  29. package/cjs/logLevels.js.map +1 -0
  30. package/cjs/logStore.d.ts +20 -0
  31. package/cjs/logStore.d.ts.map +1 -0
  32. package/cjs/logStore.js +44 -0
  33. package/cjs/logStore.js.map +1 -0
  34. package/cjs/logStore.spec.d.ts +2 -0
  35. package/cjs/logStore.spec.d.ts.map +1 -0
  36. package/cjs/logStore.spec.js +93 -0
  37. package/cjs/logStore.spec.js.map +1 -0
  38. package/cjs/logger.d.ts +6 -0
  39. package/cjs/logger.d.ts.map +1 -0
  40. package/cjs/logger.js +97 -0
  41. package/cjs/logger.js.map +1 -0
  42. package/{esm/memory/MemoryLogReporter.d.ts → cjs/memory.d.ts} +2 -2
  43. package/cjs/memory.d.ts.map +1 -0
  44. package/cjs/memory.js +39 -0
  45. package/cjs/memory.js.map +1 -0
  46. package/cjs/memory.spec.d.ts +2 -0
  47. package/cjs/memory.spec.d.ts.map +1 -0
  48. package/cjs/memory.spec.js +115 -0
  49. package/cjs/memory.spec.js.map +1 -0
  50. package/cjs/package.json +1 -3
  51. package/cjs/platform.browser.d.ts +7 -0
  52. package/cjs/platform.browser.d.ts.map +1 -0
  53. package/cjs/platform.browser.js +11 -0
  54. package/cjs/platform.browser.js.map +1 -0
  55. package/cjs/platform.d.ts +8 -0
  56. package/cjs/platform.d.ts.map +1 -0
  57. package/cjs/platform.js +26 -0
  58. package/cjs/platform.js.map +1 -0
  59. package/cjs/platform.spec.d.ts +2 -0
  60. package/cjs/platform.spec.d.ts.map +1 -0
  61. package/cjs/platform.spec.js +22 -0
  62. package/cjs/platform.spec.js.map +1 -0
  63. package/cjs/standardLog.d.ts +21 -0
  64. package/cjs/standardLog.d.ts.map +1 -0
  65. package/cjs/standardLog.js +59 -0
  66. package/cjs/standardLog.js.map +1 -0
  67. package/cjs/standardLog.spec.d.ts +2 -0
  68. package/cjs/standardLog.spec.d.ts.map +1 -0
  69. package/cjs/standardLog.spec.js +548 -0
  70. package/cjs/standardLog.spec.js.map +1 -0
  71. package/cjs/testUtil.d.ts +7 -4
  72. package/cjs/testUtil.d.ts.map +1 -1
  73. package/cjs/testUtil.js +16 -13
  74. package/cjs/testUtil.js.map +1 -1
  75. package/cjs/types.d.ts +33 -24
  76. package/cjs/types.d.ts.map +1 -1
  77. package/cjs/types.js.map +1 -1
  78. package/dist/standard-log.es5.js +326 -1079
  79. package/dist/standard-log.es5.js.gz +0 -0
  80. package/dist/standard-log.es5.js.map +1 -1
  81. package/dist/standard-log.es5.js.map.gz +0 -0
  82. package/dist/standard-log.esm.js +309 -1146
  83. package/dist/standard-log.esm.js.gz +0 -0
  84. package/dist/standard-log.esm.js.map +1 -1
  85. package/dist/standard-log.esm.js.map.gz +0 -0
  86. package/{cjs/console/createConsoleLogReporter.d.ts → esm/console.d.ts} +5 -5
  87. package/esm/console.d.ts.map +1 -0
  88. package/esm/{console/polyfilledConsole.js → console.js} +36 -4
  89. package/esm/console.js.map +1 -0
  90. package/esm/console.spec.d.ts +2 -0
  91. package/esm/console.spec.d.ts.map +1 -0
  92. package/esm/{console/createConsoleLogReporter.spec.js → console.spec.js} +50 -52
  93. package/esm/console.spec.js.map +1 -0
  94. package/esm/errors.d.ts +1 -11
  95. package/esm/errors.d.ts.map +1 -1
  96. package/esm/errors.js +2 -36
  97. package/esm/errors.js.map +1 -1
  98. package/esm/formatter.d.ts +6 -0
  99. package/esm/formatter.d.ts.map +1 -0
  100. package/esm/{formatter/createTimestampFormatter.js → formatter.js} +10 -2
  101. package/esm/formatter.js.map +1 -0
  102. package/esm/formatter.spec.d.ts +2 -0
  103. package/esm/formatter.spec.d.ts.map +1 -0
  104. package/esm/formatter.spec.js +30 -0
  105. package/esm/formatter.spec.js.map +1 -0
  106. package/esm/index.d.ts +5 -14
  107. package/esm/index.d.ts.map +1 -1
  108. package/esm/index.js +5 -14
  109. package/esm/index.js.map +1 -1
  110. package/esm/logLevels.d.ts +60 -0
  111. package/esm/logLevels.d.ts.map +1 -0
  112. package/esm/{logLevel.js → logLevels.js} +29 -3
  113. package/esm/logLevels.js.map +1 -0
  114. package/esm/logStore.d.ts +20 -0
  115. package/esm/logStore.d.ts.map +1 -0
  116. package/esm/logStore.js +37 -0
  117. package/esm/logStore.js.map +1 -0
  118. package/esm/logStore.spec.d.ts +2 -0
  119. package/esm/logStore.spec.d.ts.map +1 -0
  120. package/esm/logStore.spec.js +93 -0
  121. package/esm/logStore.spec.js.map +1 -0
  122. package/esm/logger.d.ts +6 -0
  123. package/esm/logger.d.ts.map +1 -0
  124. package/esm/logger.js +74 -0
  125. package/esm/logger.js.map +1 -0
  126. package/{cjs/memory/MemoryLogReporter.d.ts → esm/memory.d.ts} +2 -2
  127. package/esm/memory.d.ts.map +1 -0
  128. package/esm/memory.js +34 -0
  129. package/esm/memory.js.map +1 -0
  130. package/esm/memory.spec.d.ts +2 -0
  131. package/esm/memory.spec.d.ts.map +1 -0
  132. package/esm/memory.spec.js +110 -0
  133. package/esm/memory.spec.js.map +1 -0
  134. package/esm/platform.browser.d.ts +7 -0
  135. package/esm/platform.browser.d.ts.map +1 -0
  136. package/esm/platform.browser.js +6 -0
  137. package/esm/platform.browser.js.map +1 -0
  138. package/esm/platform.d.ts +8 -0
  139. package/esm/platform.d.ts.map +1 -0
  140. package/esm/platform.js +20 -0
  141. package/esm/platform.js.map +1 -0
  142. package/esm/platform.spec.d.ts +2 -0
  143. package/esm/platform.spec.d.ts.map +1 -0
  144. package/esm/{console/semverGt.spec.js → platform.spec.js} +2 -2
  145. package/esm/platform.spec.js.map +1 -0
  146. package/esm/standardLog.d.ts +21 -0
  147. package/esm/standardLog.d.ts.map +1 -0
  148. package/esm/standardLog.js +36 -0
  149. package/esm/standardLog.js.map +1 -0
  150. package/esm/standardLog.spec.d.ts +2 -0
  151. package/esm/standardLog.spec.d.ts.map +1 -0
  152. package/esm/standardLog.spec.js +446 -0
  153. package/esm/standardLog.spec.js.map +1 -0
  154. package/esm/testUtil.d.ts +7 -4
  155. package/esm/testUtil.d.ts.map +1 -1
  156. package/esm/testUtil.js +11 -11
  157. package/esm/testUtil.js.map +1 -1
  158. package/esm/types.d.ts +33 -24
  159. package/esm/types.d.ts.map +1 -1
  160. package/esm/types.js.map +1 -1
  161. package/package.json +12 -20
  162. package/ts/console.ts +72 -0
  163. package/ts/errors.ts +2 -14
  164. package/ts/{formatter/createTimestampFormatter.ts → formatter.ts} +12 -1
  165. package/ts/index.ts +5 -14
  166. package/ts/{logLevel.ts → logLevels.ts} +20 -3
  167. package/ts/logStore.ts +52 -0
  168. package/ts/logger.ts +85 -0
  169. package/ts/memory.ts +47 -0
  170. package/ts/platform.browser.ts +8 -0
  171. package/ts/platform.ts +25 -0
  172. package/ts/standardLog.ts +54 -0
  173. package/ts/types.ts +39 -30
  174. package/cjs/LogEntry.d.ts +0 -7
  175. package/cjs/LogEntry.d.ts.map +0 -1
  176. package/cjs/LogEntry.js +0 -3
  177. package/cjs/LogEntry.js.map +0 -1
  178. package/cjs/captureLogs.d.ts +0 -4
  179. package/cjs/captureLogs.d.ts.map +0 -1
  180. package/cjs/captureLogs.js +0 -33
  181. package/cjs/captureLogs.js.map +0 -1
  182. package/cjs/captureLogs.spec.d.ts +0 -2
  183. package/cjs/captureLogs.spec.d.ts.map +0 -1
  184. package/cjs/captureLogs.spec.js +0 -117
  185. package/cjs/captureLogs.spec.js.map +0 -1
  186. package/cjs/config.d.ts +0 -12
  187. package/cjs/config.d.ts.map +0 -1
  188. package/cjs/config.js +0 -59
  189. package/cjs/config.js.map +0 -1
  190. package/cjs/config.spec.d.ts +0 -2
  191. package/cjs/config.spec.d.ts.map +0 -1
  192. package/cjs/config.spec.js +0 -66
  193. package/cjs/config.spec.js.map +0 -1
  194. package/cjs/configForTest.d.ts +0 -5
  195. package/cjs/configForTest.d.ts.map +0 -1
  196. package/cjs/configForTest.js +0 -18
  197. package/cjs/configForTest.js.map +0 -1
  198. package/cjs/configForTest.spec.d.ts +0 -2
  199. package/cjs/configForTest.spec.d.ts.map +0 -1
  200. package/cjs/configForTest.spec.js +0 -17
  201. package/cjs/configForTest.spec.js.map +0 -1
  202. package/cjs/console/createConsoleLogReporter.d.ts.map +0 -1
  203. package/cjs/console/createConsoleLogReporter.js +0 -42
  204. package/cjs/console/createConsoleLogReporter.js.map +0 -1
  205. package/cjs/console/createConsoleLogReporter.spec.d.ts +0 -2
  206. package/cjs/console/createConsoleLogReporter.spec.d.ts.map +0 -1
  207. package/cjs/console/createConsoleLogReporter.spec.js.map +0 -1
  208. package/cjs/console/index.d.ts +0 -4
  209. package/cjs/console/index.d.ts.map +0 -1
  210. package/cjs/console/index.js +0 -20
  211. package/cjs/console/index.js.map +0 -1
  212. package/cjs/console/isConsoleDebugAvailable.d.ts +0 -2
  213. package/cjs/console/isConsoleDebugAvailable.d.ts.map +0 -1
  214. package/cjs/console/isConsoleDebugAvailable.js +0 -20
  215. package/cjs/console/isConsoleDebugAvailable.js.map +0 -1
  216. package/cjs/console/polyfilledConsole.d.ts +0 -7
  217. package/cjs/console/polyfilledConsole.d.ts.map +0 -1
  218. package/cjs/console/polyfilledConsole.js +0 -41
  219. package/cjs/console/polyfilledConsole.js.map +0 -1
  220. package/cjs/console/semverGt.d.ts +0 -2
  221. package/cjs/console/semverGt.d.ts.map +0 -1
  222. package/cjs/console/semverGt.js +0 -13
  223. package/cjs/console/semverGt.js.map +0 -1
  224. package/cjs/console/semverGt.spec.d.ts +0 -2
  225. package/cjs/console/semverGt.spec.d.ts.map +0 -1
  226. package/cjs/console/semverGt.spec.js +0 -22
  227. package/cjs/console/semverGt.spec.js.map +0 -1
  228. package/cjs/console/toConsoleMethod.d.ts +0 -2
  229. package/cjs/console/toConsoleMethod.d.ts.map +0 -1
  230. package/cjs/console/toConsoleMethod.js +0 -22
  231. package/cjs/console/toConsoleMethod.js.map +0 -1
  232. package/cjs/console/types.d.ts +0 -3
  233. package/cjs/console/types.d.ts.map +0 -1
  234. package/cjs/console/types.js +0 -3
  235. package/cjs/console/types.js.map +0 -1
  236. package/cjs/customLogLevel.d.ts +0 -11
  237. package/cjs/customLogLevel.d.ts.map +0 -1
  238. package/cjs/customLogLevel.js +0 -38
  239. package/cjs/customLogLevel.js.map +0 -1
  240. package/cjs/customLogLevel.spec.d.ts +0 -2
  241. package/cjs/customLogLevel.spec.d.ts.map +0 -1
  242. package/cjs/customLogLevel.spec.js +0 -37
  243. package/cjs/customLogLevel.spec.js.map +0 -1
  244. package/cjs/formatter/createTimestampFormatter.d.ts +0 -3
  245. package/cjs/formatter/createTimestampFormatter.d.ts.map +0 -1
  246. package/cjs/formatter/createTimestampFormatter.js +0 -26
  247. package/cjs/formatter/createTimestampFormatter.js.map +0 -1
  248. package/cjs/formatter/createTimestampFormatter.spec.d.ts +0 -2
  249. package/cjs/formatter/createTimestampFormatter.spec.d.ts.map +0 -1
  250. package/cjs/formatter/createTimestampFormatter.spec.js +0 -23
  251. package/cjs/formatter/createTimestampFormatter.spec.js.map +0 -1
  252. package/cjs/formatter/formatLogLevel.d.ts +0 -2
  253. package/cjs/formatter/formatLogLevel.d.ts.map +0 -1
  254. package/cjs/formatter/formatLogLevel.js +0 -10
  255. package/cjs/formatter/formatLogLevel.js.map +0 -1
  256. package/cjs/formatter/index.d.ts +0 -4
  257. package/cjs/formatter/index.d.ts.map +0 -1
  258. package/cjs/formatter/index.js +0 -20
  259. package/cjs/formatter/index.js.map +0 -1
  260. package/cjs/formatter/plainLogFormatter.d.ts +0 -3
  261. package/cjs/formatter/plainLogFormatter.d.ts.map +0 -1
  262. package/cjs/formatter/plainLogFormatter.js +0 -19
  263. package/cjs/formatter/plainLogFormatter.js.map +0 -1
  264. package/cjs/formatter/plainLogFormatter.spec.d.ts +0 -2
  265. package/cjs/formatter/plainLogFormatter.spec.d.ts.map +0 -1
  266. package/cjs/formatter/plainLogFormatter.spec.js +0 -9
  267. package/cjs/formatter/plainLogFormatter.spec.js.map +0 -1
  268. package/cjs/getDefaultReporter.browser.d.ts +0 -2
  269. package/cjs/getDefaultReporter.browser.d.ts.map +0 -1
  270. package/cjs/getDefaultReporter.browser.js +0 -15
  271. package/cjs/getDefaultReporter.browser.js.map +0 -1
  272. package/cjs/getDefaultReporter.d.ts +0 -2
  273. package/cjs/getDefaultReporter.d.ts.map +0 -1
  274. package/cjs/getDefaultReporter.js +0 -19
  275. package/cjs/getDefaultReporter.js.map +0 -1
  276. package/cjs/getLogModeFromEnvironment.browser.d.ts +0 -3
  277. package/cjs/getLogModeFromEnvironment.browser.d.ts.map +0 -1
  278. package/cjs/getLogModeFromEnvironment.browser.js +0 -9
  279. package/cjs/getLogModeFromEnvironment.browser.js.map +0 -1
  280. package/cjs/getLogModeFromEnvironment.d.ts +0 -3
  281. package/cjs/getLogModeFromEnvironment.d.ts.map +0 -1
  282. package/cjs/getLogModeFromEnvironment.js +0 -17
  283. package/cjs/getLogModeFromEnvironment.js.map +0 -1
  284. package/cjs/getLogModeFromEnvironment.spec.d.ts +0 -2
  285. package/cjs/getLogModeFromEnvironment.spec.d.ts.map +0 -1
  286. package/cjs/getLogModeFromEnvironment.spec.js +0 -19
  287. package/cjs/getLogModeFromEnvironment.spec.js.map +0 -1
  288. package/cjs/getLogger.d.ts +0 -9
  289. package/cjs/getLogger.d.ts.map +0 -1
  290. package/cjs/getLogger.js +0 -103
  291. package/cjs/getLogger.js.map +0 -1
  292. package/cjs/getLogger.spec.d.ts +0 -2
  293. package/cjs/getLogger.spec.d.ts.map +0 -1
  294. package/cjs/getLogger.spec.js +0 -481
  295. package/cjs/getLogger.spec.js.map +0 -1
  296. package/cjs/getLoggers.d.ts +0 -7
  297. package/cjs/getLoggers.d.ts.map +0 -1
  298. package/cjs/getLoggers.js +0 -15
  299. package/cjs/getLoggers.js.map +0 -1
  300. package/cjs/logLevel.d.ts +0 -106
  301. package/cjs/logLevel.d.ts.map +0 -1
  302. package/cjs/logLevel.js +0 -59
  303. package/cjs/logLevel.js.map +0 -1
  304. package/cjs/logLevel.spec.d.ts +0 -2
  305. package/cjs/logLevel.spec.d.ts.map +0 -1
  306. package/cjs/logLevel.spec.js +0 -195
  307. package/cjs/logLevel.spec.js.map +0 -1
  308. package/cjs/logLevelFn.d.ts +0 -20
  309. package/cjs/logLevelFn.d.ts.map +0 -1
  310. package/cjs/logLevelFn.js +0 -76
  311. package/cjs/logLevelFn.js.map +0 -1
  312. package/cjs/logReporter.d.ts +0 -7
  313. package/cjs/logReporter.d.ts.map +0 -1
  314. package/cjs/logReporter.js +0 -29
  315. package/cjs/logReporter.js.map +0 -1
  316. package/cjs/logReporter.spec.d.ts +0 -2
  317. package/cjs/logReporter.spec.d.ts.map +0 -1
  318. package/cjs/logReporter.spec.js +0 -86
  319. package/cjs/logReporter.spec.js.map +0 -1
  320. package/cjs/logReporterInternal.d.ts +0 -3
  321. package/cjs/logReporterInternal.d.ts.map +0 -1
  322. package/cjs/logReporterInternal.js +0 -23
  323. package/cjs/logReporterInternal.js.map +0 -1
  324. package/cjs/memory/MemoryLogReporter.d.ts.map +0 -1
  325. package/cjs/memory/MemoryLogReporter.js +0 -56
  326. package/cjs/memory/MemoryLogReporter.js.map +0 -1
  327. package/cjs/memory/MemoryLogReporter.spec.d.ts +0 -2
  328. package/cjs/memory/MemoryLogReporter.spec.d.ts.map +0 -1
  329. package/cjs/memory/MemoryLogReporter.spec.js +0 -111
  330. package/cjs/memory/MemoryLogReporter.spec.js.map +0 -1
  331. package/cjs/memory/index.d.ts +0 -3
  332. package/cjs/memory/index.d.ts.map +0 -1
  333. package/cjs/memory/index.js +0 -19
  334. package/cjs/memory/index.js.map +0 -1
  335. package/cjs/memory/logEntriesToString.d.ts +0 -3
  336. package/cjs/memory/logEntriesToString.d.ts.map +0 -1
  337. package/cjs/memory/logEntriesToString.js +0 -10
  338. package/cjs/memory/logEntriesToString.js.map +0 -1
  339. package/cjs/memory/logEntriesToString.spec.d.ts +0 -2
  340. package/cjs/memory/logEntriesToString.spec.d.ts.map +0 -1
  341. package/cjs/memory/logEntriesToString.spec.js +0 -36
  342. package/cjs/memory/logEntriesToString.spec.js.map +0 -1
  343. package/cjs/memory/toInspectStringForObject.d.ts +0 -3
  344. package/cjs/memory/toInspectStringForObject.d.ts.map +0 -1
  345. package/cjs/memory/toInspectStringForObject.js +0 -17
  346. package/cjs/memory/toInspectStringForObject.js.map +0 -1
  347. package/cjs/shouldLog.d.ts +0 -8
  348. package/cjs/shouldLog.d.ts.map +0 -1
  349. package/cjs/shouldLog.js +0 -14
  350. package/cjs/shouldLog.js.map +0 -1
  351. package/cjs/store.d.ts +0 -3
  352. package/cjs/store.d.ts.map +0 -1
  353. package/cjs/store.js +0 -27
  354. package/cjs/store.js.map +0 -1
  355. package/cjs/suppressLogs.d.ts +0 -6
  356. package/cjs/suppressLogs.d.ts.map +0 -1
  357. package/cjs/suppressLogs.js +0 -17
  358. package/cjs/suppressLogs.js.map +0 -1
  359. package/cjs/suppressLogs.spec.d.ts +0 -2
  360. package/cjs/suppressLogs.spec.d.ts.map +0 -1
  361. package/cjs/suppressLogs.spec.js +0 -31
  362. package/cjs/suppressLogs.spec.js.map +0 -1
  363. package/cjs/typesInternal.d.ts +0 -20
  364. package/cjs/typesInternal.d.ts.map +0 -1
  365. package/cjs/typesInternal.js +0 -3
  366. package/cjs/typesInternal.js.map +0 -1
  367. package/cjs/utils.d.ts +0 -5
  368. package/cjs/utils.d.ts.map +0 -1
  369. package/cjs/utils.js +0 -14
  370. package/cjs/utils.js.map +0 -1
  371. package/cjs/writeToReporters.d.ts +0 -6
  372. package/cjs/writeToReporters.d.ts.map +0 -1
  373. package/cjs/writeToReporters.js +0 -22
  374. package/cjs/writeToReporters.js.map +0 -1
  375. package/cjs/writeToReporters.spec.d.ts +0 -2
  376. package/cjs/writeToReporters.spec.d.ts.map +0 -1
  377. package/cjs/writeToReporters.spec.js +0 -59
  378. package/cjs/writeToReporters.spec.js.map +0 -1
  379. package/esm/LogEntry.d.ts +0 -7
  380. package/esm/LogEntry.d.ts.map +0 -1
  381. package/esm/LogEntry.js +0 -2
  382. package/esm/LogEntry.js.map +0 -1
  383. package/esm/captureLogs.d.ts +0 -4
  384. package/esm/captureLogs.d.ts.map +0 -1
  385. package/esm/captureLogs.js +0 -29
  386. package/esm/captureLogs.js.map +0 -1
  387. package/esm/captureLogs.spec.d.ts +0 -2
  388. package/esm/captureLogs.spec.d.ts.map +0 -1
  389. package/esm/captureLogs.spec.js +0 -45
  390. package/esm/captureLogs.spec.js.map +0 -1
  391. package/esm/config.d.ts +0 -12
  392. package/esm/config.d.ts.map +0 -1
  393. package/esm/config.js +0 -44
  394. package/esm/config.js.map +0 -1
  395. package/esm/config.spec.d.ts +0 -2
  396. package/esm/config.spec.d.ts.map +0 -1
  397. package/esm/config.spec.js +0 -61
  398. package/esm/config.spec.js.map +0 -1
  399. package/esm/configForTest.d.ts +0 -5
  400. package/esm/configForTest.d.ts.map +0 -1
  401. package/esm/configForTest.js +0 -14
  402. package/esm/configForTest.js.map +0 -1
  403. package/esm/configForTest.spec.d.ts +0 -2
  404. package/esm/configForTest.spec.d.ts.map +0 -1
  405. package/esm/configForTest.spec.js +0 -15
  406. package/esm/configForTest.spec.js.map +0 -1
  407. package/esm/console/createConsoleLogReporter.d.ts.map +0 -1
  408. package/esm/console/createConsoleLogReporter.js +0 -37
  409. package/esm/console/createConsoleLogReporter.js.map +0 -1
  410. package/esm/console/createConsoleLogReporter.spec.d.ts +0 -2
  411. package/esm/console/createConsoleLogReporter.spec.d.ts.map +0 -1
  412. package/esm/console/createConsoleLogReporter.spec.js.map +0 -1
  413. package/esm/console/index.d.ts +0 -4
  414. package/esm/console/index.d.ts.map +0 -1
  415. package/esm/console/index.js +0 -4
  416. package/esm/console/index.js.map +0 -1
  417. package/esm/console/isConsoleDebugAvailable.d.ts +0 -2
  418. package/esm/console/isConsoleDebugAvailable.d.ts.map +0 -1
  419. package/esm/console/isConsoleDebugAvailable.js +0 -13
  420. package/esm/console/isConsoleDebugAvailable.js.map +0 -1
  421. package/esm/console/polyfilledConsole.d.ts +0 -7
  422. package/esm/console/polyfilledConsole.d.ts.map +0 -1
  423. package/esm/console/polyfilledConsole.js.map +0 -1
  424. package/esm/console/semverGt.d.ts +0 -2
  425. package/esm/console/semverGt.d.ts.map +0 -1
  426. package/esm/console/semverGt.js +0 -9
  427. package/esm/console/semverGt.js.map +0 -1
  428. package/esm/console/semverGt.spec.d.ts +0 -2
  429. package/esm/console/semverGt.spec.d.ts.map +0 -1
  430. package/esm/console/semverGt.spec.js.map +0 -1
  431. package/esm/console/toConsoleMethod.d.ts +0 -2
  432. package/esm/console/toConsoleMethod.d.ts.map +0 -1
  433. package/esm/console/toConsoleMethod.js +0 -18
  434. package/esm/console/toConsoleMethod.js.map +0 -1
  435. package/esm/console/types.d.ts +0 -3
  436. package/esm/console/types.d.ts.map +0 -1
  437. package/esm/console/types.js +0 -2
  438. package/esm/console/types.js.map +0 -1
  439. package/esm/customLogLevel.d.ts +0 -11
  440. package/esm/customLogLevel.d.ts.map +0 -1
  441. package/esm/customLogLevel.js +0 -30
  442. package/esm/customLogLevel.js.map +0 -1
  443. package/esm/customLogLevel.spec.d.ts +0 -2
  444. package/esm/customLogLevel.spec.d.ts.map +0 -1
  445. package/esm/customLogLevel.spec.js +0 -32
  446. package/esm/customLogLevel.spec.js.map +0 -1
  447. package/esm/formatter/createTimestampFormatter.d.ts +0 -3
  448. package/esm/formatter/createTimestampFormatter.d.ts.map +0 -1
  449. package/esm/formatter/createTimestampFormatter.js.map +0 -1
  450. package/esm/formatter/createTimestampFormatter.spec.d.ts +0 -2
  451. package/esm/formatter/createTimestampFormatter.spec.d.ts.map +0 -1
  452. package/esm/formatter/createTimestampFormatter.spec.js +0 -21
  453. package/esm/formatter/createTimestampFormatter.spec.js.map +0 -1
  454. package/esm/formatter/formatLogLevel.d.ts +0 -2
  455. package/esm/formatter/formatLogLevel.d.ts.map +0 -1
  456. package/esm/formatter/formatLogLevel.js +0 -6
  457. package/esm/formatter/formatLogLevel.js.map +0 -1
  458. package/esm/formatter/index.d.ts +0 -4
  459. package/esm/formatter/index.d.ts.map +0 -1
  460. package/esm/formatter/index.js +0 -4
  461. package/esm/formatter/index.js.map +0 -1
  462. package/esm/formatter/plainLogFormatter.d.ts +0 -3
  463. package/esm/formatter/plainLogFormatter.d.ts.map +0 -1
  464. package/esm/formatter/plainLogFormatter.js +0 -5
  465. package/esm/formatter/plainLogFormatter.js.map +0 -1
  466. package/esm/formatter/plainLogFormatter.spec.d.ts +0 -2
  467. package/esm/formatter/plainLogFormatter.spec.d.ts.map +0 -1
  468. package/esm/formatter/plainLogFormatter.spec.js +0 -7
  469. package/esm/formatter/plainLogFormatter.spec.js.map +0 -1
  470. package/esm/getDefaultReporter.browser.d.ts +0 -2
  471. package/esm/getDefaultReporter.browser.d.ts.map +0 -1
  472. package/esm/getDefaultReporter.browser.js +0 -11
  473. package/esm/getDefaultReporter.browser.js.map +0 -1
  474. package/esm/getDefaultReporter.d.ts +0 -2
  475. package/esm/getDefaultReporter.d.ts.map +0 -1
  476. package/esm/getDefaultReporter.js +0 -15
  477. package/esm/getDefaultReporter.js.map +0 -1
  478. package/esm/getLogModeFromEnvironment.browser.d.ts +0 -3
  479. package/esm/getLogModeFromEnvironment.browser.d.ts.map +0 -1
  480. package/esm/getLogModeFromEnvironment.browser.js +0 -5
  481. package/esm/getLogModeFromEnvironment.browser.js.map +0 -1
  482. package/esm/getLogModeFromEnvironment.d.ts +0 -3
  483. package/esm/getLogModeFromEnvironment.d.ts.map +0 -1
  484. package/esm/getLogModeFromEnvironment.js +0 -13
  485. package/esm/getLogModeFromEnvironment.js.map +0 -1
  486. package/esm/getLogModeFromEnvironment.spec.d.ts +0 -2
  487. package/esm/getLogModeFromEnvironment.spec.d.ts.map +0 -1
  488. package/esm/getLogModeFromEnvironment.spec.js +0 -14
  489. package/esm/getLogModeFromEnvironment.spec.js.map +0 -1
  490. package/esm/getLogger.d.ts +0 -9
  491. package/esm/getLogger.d.ts.map +0 -1
  492. package/esm/getLogger.js +0 -78
  493. package/esm/getLogger.js.map +0 -1
  494. package/esm/getLogger.spec.d.ts +0 -2
  495. package/esm/getLogger.spec.d.ts.map +0 -1
  496. package/esm/getLogger.spec.js +0 -381
  497. package/esm/getLogger.spec.js.map +0 -1
  498. package/esm/getLoggers.d.ts +0 -7
  499. package/esm/getLoggers.d.ts.map +0 -1
  500. package/esm/getLoggers.js +0 -11
  501. package/esm/getLoggers.js.map +0 -1
  502. package/esm/logLevel.d.ts +0 -106
  503. package/esm/logLevel.d.ts.map +0 -1
  504. package/esm/logLevel.js.map +0 -1
  505. package/esm/logLevel.spec.d.ts +0 -2
  506. package/esm/logLevel.spec.d.ts.map +0 -1
  507. package/esm/logLevel.spec.js +0 -148
  508. package/esm/logLevel.spec.js.map +0 -1
  509. package/esm/logLevelFn.d.ts +0 -20
  510. package/esm/logLevelFn.d.ts.map +0 -1
  511. package/esm/logLevelFn.js +0 -67
  512. package/esm/logLevelFn.js.map +0 -1
  513. package/esm/logReporter.d.ts +0 -7
  514. package/esm/logReporter.d.ts.map +0 -1
  515. package/esm/logReporter.js +0 -21
  516. package/esm/logReporter.js.map +0 -1
  517. package/esm/logReporter.spec.d.ts +0 -2
  518. package/esm/logReporter.spec.d.ts.map +0 -1
  519. package/esm/logReporter.spec.js +0 -81
  520. package/esm/logReporter.spec.js.map +0 -1
  521. package/esm/logReporterInternal.d.ts +0 -3
  522. package/esm/logReporterInternal.d.ts.map +0 -1
  523. package/esm/logReporterInternal.js +0 -19
  524. package/esm/logReporterInternal.js.map +0 -1
  525. package/esm/memory/MemoryLogReporter.d.ts.map +0 -1
  526. package/esm/memory/MemoryLogReporter.js +0 -51
  527. package/esm/memory/MemoryLogReporter.js.map +0 -1
  528. package/esm/memory/MemoryLogReporter.spec.d.ts +0 -2
  529. package/esm/memory/MemoryLogReporter.spec.d.ts.map +0 -1
  530. package/esm/memory/MemoryLogReporter.spec.js +0 -98
  531. package/esm/memory/MemoryLogReporter.spec.js.map +0 -1
  532. package/esm/memory/index.d.ts +0 -3
  533. package/esm/memory/index.d.ts.map +0 -1
  534. package/esm/memory/index.js +0 -3
  535. package/esm/memory/index.js.map +0 -1
  536. package/esm/memory/logEntriesToString.d.ts +0 -3
  537. package/esm/memory/logEntriesToString.d.ts.map +0 -1
  538. package/esm/memory/logEntriesToString.js +0 -6
  539. package/esm/memory/logEntriesToString.js.map +0 -1
  540. package/esm/memory/logEntriesToString.spec.d.ts +0 -2
  541. package/esm/memory/logEntriesToString.spec.d.ts.map +0 -1
  542. package/esm/memory/logEntriesToString.spec.js +0 -42
  543. package/esm/memory/logEntriesToString.spec.js.map +0 -1
  544. package/esm/memory/toInspectStringForObject.d.ts +0 -3
  545. package/esm/memory/toInspectStringForObject.d.ts.map +0 -1
  546. package/esm/memory/toInspectStringForObject.js +0 -11
  547. package/esm/memory/toInspectStringForObject.js.map +0 -1
  548. package/esm/shouldLog.d.ts +0 -8
  549. package/esm/shouldLog.d.ts.map +0 -1
  550. package/esm/shouldLog.js +0 -10
  551. package/esm/shouldLog.js.map +0 -1
  552. package/esm/store.d.ts +0 -3
  553. package/esm/store.d.ts.map +0 -1
  554. package/esm/store.js +0 -24
  555. package/esm/store.js.map +0 -1
  556. package/esm/suppressLogs.d.ts +0 -6
  557. package/esm/suppressLogs.d.ts.map +0 -1
  558. package/esm/suppressLogs.js +0 -9
  559. package/esm/suppressLogs.js.map +0 -1
  560. package/esm/suppressLogs.spec.d.ts +0 -2
  561. package/esm/suppressLogs.spec.d.ts.map +0 -1
  562. package/esm/suppressLogs.spec.js +0 -29
  563. package/esm/suppressLogs.spec.js.map +0 -1
  564. package/esm/typesInternal.d.ts +0 -20
  565. package/esm/typesInternal.d.ts.map +0 -1
  566. package/esm/typesInternal.js +0 -2
  567. package/esm/typesInternal.js.map +0 -1
  568. package/esm/utils.d.ts +0 -5
  569. package/esm/utils.d.ts.map +0 -1
  570. package/esm/utils.js +0 -10
  571. package/esm/utils.js.map +0 -1
  572. package/esm/writeToReporters.d.ts +0 -6
  573. package/esm/writeToReporters.d.ts.map +0 -1
  574. package/esm/writeToReporters.js +0 -18
  575. package/esm/writeToReporters.js.map +0 -1
  576. package/esm/writeToReporters.spec.d.ts +0 -2
  577. package/esm/writeToReporters.spec.d.ts.map +0 -1
  578. package/esm/writeToReporters.spec.js +0 -9
  579. package/esm/writeToReporters.spec.js.map +0 -1
  580. package/ts/LogEntry.ts +0 -7
  581. package/ts/captureLogs.ts +0 -35
  582. package/ts/config.ts +0 -57
  583. package/ts/configForTest.ts +0 -16
  584. package/ts/console/createConsoleLogReporter.ts +0 -42
  585. package/ts/console/index.ts +0 -3
  586. package/ts/console/isConsoleDebugAvailable.ts +0 -11
  587. package/ts/console/polyfilledConsole.ts +0 -34
  588. package/ts/console/semverGt.ts +0 -9
  589. package/ts/console/toConsoleMethod.ts +0 -18
  590. package/ts/console/types.ts +0 -3
  591. package/ts/customLogLevel.ts +0 -35
  592. package/ts/formatter/formatLogLevel.ts +0 -6
  593. package/ts/formatter/index.ts +0 -3
  594. package/ts/formatter/plainLogFormatter.ts +0 -6
  595. package/ts/getDefaultReporter.browser.ts +0 -13
  596. package/ts/getDefaultReporter.ts +0 -15
  597. package/ts/getLogModeFromEnvironment.browser.ts +0 -6
  598. package/ts/getLogModeFromEnvironment.ts +0 -16
  599. package/ts/getLogger.ts +0 -92
  600. package/ts/getLoggers.ts +0 -12
  601. package/ts/logLevelFn.ts +0 -72
  602. package/ts/logReporter.ts +0 -26
  603. package/ts/logReporterInternal.ts +0 -18
  604. package/ts/memory/MemoryLogReporter.ts +0 -66
  605. package/ts/memory/index.ts +0 -2
  606. package/ts/memory/logEntriesToString.ts +0 -7
  607. package/ts/memory/toInspectStringForObject.ts +0 -13
  608. package/ts/shouldLog.ts +0 -11
  609. package/ts/store.ts +0 -25
  610. package/ts/suppressLogs.ts +0 -14
  611. package/ts/testUtil.ts +0 -19
  612. package/ts/typesInternal.ts +0 -21
  613. package/ts/utils.ts +0 -9
  614. package/ts/writeToReporters.ts +0 -20
package/cjs/logLevel.d.ts DELETED
@@ -1,106 +0,0 @@
1
- export declare const logLevels: {
2
- /**
3
- * none: 0
4
- */
5
- none: number;
6
- /**
7
- * emergency: 100
8
- */
9
- emergency: number;
10
- /**
11
- * alert: 200
12
- */
13
- alert: number;
14
- /**
15
- * critical: 300
16
- */
17
- critical: number;
18
- /**
19
- * error: 400
20
- */
21
- error: number;
22
- /**
23
- * warn: 500
24
- */
25
- warn: number;
26
- /**
27
- * notice: 600
28
- */
29
- notice: number;
30
- /**
31
- * info: 700
32
- */
33
- info: number;
34
- /**
35
- * debug: 800
36
- */
37
- debug: number;
38
- /**
39
- * trace: 900
40
- */
41
- trace: number;
42
- /**
43
- * planck: Infinity
44
- * `planck unit` is a very small unit <https://en.wikipedia.org/wiki/Planck_units>.
45
- */
46
- planck: number;
47
- /**
48
- * all: Infinity
49
- */
50
- all: number;
51
- };
52
- /**
53
- * @deprecated logLevel is renamed to logLevels
54
- */
55
- export declare const logLevel: {
56
- /**
57
- * none: 0
58
- */
59
- none: number;
60
- /**
61
- * emergency: 100
62
- */
63
- emergency: number;
64
- /**
65
- * alert: 200
66
- */
67
- alert: number;
68
- /**
69
- * critical: 300
70
- */
71
- critical: number;
72
- /**
73
- * error: 400
74
- */
75
- error: number;
76
- /**
77
- * warn: 500
78
- */
79
- warn: number;
80
- /**
81
- * notice: 600
82
- */
83
- notice: number;
84
- /**
85
- * info: 700
86
- */
87
- info: number;
88
- /**
89
- * debug: 800
90
- */
91
- debug: number;
92
- /**
93
- * trace: 900
94
- */
95
- trace: number;
96
- /**
97
- * planck: Infinity
98
- * `planck unit` is a very small unit <https://en.wikipedia.org/wiki/Planck_units>.
99
- */
100
- planck: number;
101
- /**
102
- * all: Infinity
103
- */
104
- all: number;
105
- };
106
- //# sourceMappingURL=logLevel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logLevel.d.ts","sourceRoot":"","sources":["../ts/logLevel.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,SAAS;IACpB;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;OAEG;;CAEJ,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,QAAQ;IAtDnB;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;OAEG;;IAEH;;;OAGG;;IAEH;;OAEG;;CAO4B,CAAA"}
package/cjs/logLevel.js DELETED
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.logLevel = exports.logLevels = void 0;
4
- exports.logLevels = {
5
- /**
6
- * none: 0
7
- */
8
- none: 0,
9
- /**
10
- * emergency: 100
11
- */
12
- emergency: 100,
13
- /**
14
- * alert: 200
15
- */
16
- alert: 200,
17
- /**
18
- * critical: 300
19
- */
20
- critical: 300,
21
- /**
22
- * error: 400
23
- */
24
- error: 400,
25
- /**
26
- * warn: 500
27
- */
28
- warn: 500,
29
- /**
30
- * notice: 600
31
- */
32
- notice: 600,
33
- /**
34
- * info: 700
35
- */
36
- info: 700,
37
- /**
38
- * debug: 800
39
- */
40
- debug: 800,
41
- /**
42
- * trace: 900
43
- */
44
- trace: 900,
45
- /**
46
- * planck: Infinity
47
- * `planck unit` is a very small unit <https://en.wikipedia.org/wiki/Planck_units>.
48
- */
49
- planck: Infinity,
50
- /**
51
- * all: Infinity
52
- */
53
- all: Infinity
54
- };
55
- /**
56
- * @deprecated logLevel is renamed to logLevels
57
- */
58
- exports.logLevel = exports.logLevels;
59
- //# sourceMappingURL=logLevel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logLevel.js","sourceRoot":"","sources":["../ts/logLevel.ts"],"names":[],"mappings":";;;AACa,QAAA,SAAS,GAAG;IACvB;;OAEG;IACH,IAAI,EAAE,CAAC;IACP;;OAEG;IACH,SAAS,EAAE,GAAG;IACd;;OAEG;IACH,KAAK,EAAE,GAAG;IACV;;OAEG;IACH,QAAQ,EAAE,GAAG;IACb;;OAEG;IACH,KAAK,EAAE,GAAG;IACV;;OAEG;IACH,IAAI,EAAE,GAAG;IACT;;OAEG;IACH,MAAM,EAAE,GAAG;IACX;;OAEG;IACH,IAAI,EAAE,GAAG;IACT;;OAEG;IACH,KAAK,EAAE,GAAG;IACV;;OAEG;IACH,KAAK,EAAE,GAAG;IACV;;;OAGG;IACH,MAAM,EAAE,QAAQ;IAChB;;OAEG;IACH,GAAG,EAAE,QAAQ;CACd,CAAA;AAED;;GAEG;AACU,QAAA,QAAQ,GAAG,iBAAS,CAAA","sourcesContent":["\nexport const logLevels = {\n /**\n * none: 0\n */\n none: 0,\n /**\n * emergency: 100\n */\n emergency: 100,\n /**\n * alert: 200\n */\n alert: 200,\n /**\n * critical: 300\n */\n critical: 300,\n /**\n * error: 400\n */\n error: 400,\n /**\n * warn: 500\n */\n warn: 500,\n /**\n * notice: 600\n */\n notice: 600,\n /**\n * info: 700\n */\n info: 700,\n /**\n * debug: 800\n */\n debug: 800,\n /**\n * trace: 900\n */\n trace: 900,\n /**\n * planck: Infinity\n * `planck unit` is a very small unit <https://en.wikipedia.org/wiki/Planck_units>.\n */\n planck: Infinity,\n /**\n * all: Infinity\n */\n all: Infinity\n}\n\n/**\n * @deprecated logLevel is renamed to logLevels\n */\nexport const logLevel = logLevels\n"]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=logLevel.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logLevel.spec.d.ts","sourceRoot":"","sources":["../ts/logLevel.spec.ts"],"names":[],"mappings":""}
@@ -1,195 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
39
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
40
- if (ar || !(i in from)) {
41
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
42
- ar[i] = from[i];
43
- }
44
- }
45
- return to.concat(ar || Array.prototype.slice.call(from));
46
- };
47
- var __importDefault = (this && this.__importDefault) || function (mod) {
48
- return (mod && mod.__esModule) ? mod : { "default": mod };
49
- };
50
- Object.defineProperty(exports, "__esModule", { value: true });
51
- var assert_1 = __importDefault(require("assert"));
52
- var type_plus_1 = require("type-plus");
53
- var index_js_1 = require("./index.js");
54
- var store_js_1 = require("./store.js");
55
- var testUtil_js_1 = require("./testUtil.js");
56
- function createFilterLoggers() {
57
- for (var i = 0; i < 20; i++) {
58
- (0, index_js_1.getLogger)('filter' + i);
59
- (0, index_js_1.getLogger)('filter-' + String.fromCharCode(97 + i));
60
- }
61
- }
62
- beforeAll(function () {
63
- createFilterLoggers();
64
- });
65
- afterAll(function () {
66
- store_js_1.store.reset();
67
- });
68
- describe('capture write to reporters', function () {
69
- var capture;
70
- beforeEach(function () {
71
- store_js_1.store.value.mode = 'test';
72
- store_js_1.store.value.logLevel = index_js_1.logLevels.error;
73
- capture = (0, testUtil_js_1.captureWrittenLog)();
74
- });
75
- afterEach(function () {
76
- capture.reset();
77
- });
78
- test('no matched logger do no harm', function () { return __awaiter(void 0, void 0, void 0, function () {
79
- var log;
80
- return __generator(this, function (_a) {
81
- (0, index_js_1.setLogLevels)(/x/, index_js_1.logLevels.debug);
82
- log = (0, index_js_1.getLogger)('filter1');
83
- log.debug('abc');
84
- expect(capture.logs.length).toEqual(0);
85
- return [2 /*return*/];
86
- });
87
- }); });
88
- describe('setLogLevels()', function () {
89
- beforeEach(function () {
90
- (0, index_js_1.setLogLevel)(index_js_1.logLevels.none);
91
- });
92
- test('only filtered log are affected', function () { return __awaiter(void 0, void 0, void 0, function () {
93
- var logs;
94
- return __generator(this, function (_a) {
95
- logs = (0, index_js_1.setLogLevels)(/filter1/, index_js_1.logLevels.debug);
96
- assert_1.default.deepStrictEqual(logs.map(function (l) { return l.id; }), [
97
- 'filter1',
98
- 'filter10',
99
- 'filter11',
100
- 'filter12',
101
- 'filter13',
102
- 'filter14',
103
- 'filter15',
104
- 'filter16',
105
- 'filter17',
106
- 'filter18',
107
- 'filter19'
108
- ]);
109
- (0, index_js_1.getLogger)('filter1').debug('filter1');
110
- (0, index_js_1.getLogger)('filter2').debug('filter2');
111
- (0, index_js_1.getLogger)('filter11').debug('filter11');
112
- assert_1.default.strictEqual(capture.logs.length, 2);
113
- return [2 /*return*/];
114
- });
115
- }); });
116
- });
117
- });
118
- describe('getLogLevel', function () {
119
- test('default to debug in test mode', function () {
120
- store_js_1.store.value.mode = 'test';
121
- store_js_1.store.value.logLevel = index_js_1.logLevels.debug;
122
- expect((0, index_js_1.getLogLevel)()).toBe(index_js_1.logLevels.debug);
123
- });
124
- });
125
- describe('toLogLevelName()', function () {
126
- test.each(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], (0, testUtil_js_1.rangeEntries)(99, 100, 'emergency'), true), (0, testUtil_js_1.rangeEntries)(199, 200, 'alert'), true), (0, testUtil_js_1.rangeEntries)(299, 300, 'critical'), true), (0, testUtil_js_1.rangeEntries)(399, 400, 'error'), true), (0, testUtil_js_1.rangeEntries)(499, 500, 'warn'), true), (0, testUtil_js_1.rangeEntries)(599, 600, 'notice'), true), (0, testUtil_js_1.rangeEntries)(699, 700, 'info'), true), (0, testUtil_js_1.rangeEntries)(799, 800, 'debug'), true), (0, testUtil_js_1.rangeEntries)(899, 900, 'trace'), true), (0, testUtil_js_1.rangeEntries)(9999999, 10000000, 'planck'), true))('convert %i to %s', function (level, logLevel) {
127
- expect((0, index_js_1.toLogLevelName)(level)).toBe(logLevel);
128
- });
129
- test('get custom log level name', function () {
130
- (0, index_js_1.addCustomLogLevel)('cust-name', 144);
131
- expect((0, index_js_1.toLogLevelName)(144)).toBe('cust-name');
132
- });
133
- });
134
- describe('toLogLevel()', function () {
135
- afterEach(function () { return (0, index_js_1.clearCustomLogLevel)(); });
136
- test('get default log levels', function () {
137
- var actual = [
138
- (0, index_js_1.toLogLevel)('emergency'),
139
- (0, index_js_1.toLogLevel)('alert'),
140
- (0, index_js_1.toLogLevel)('critical'),
141
- (0, index_js_1.toLogLevel)('error'),
142
- (0, index_js_1.toLogLevel)('warn'),
143
- (0, index_js_1.toLogLevel)('notice'),
144
- (0, index_js_1.toLogLevel)('info'),
145
- (0, index_js_1.toLogLevel)('debug'),
146
- (0, index_js_1.toLogLevel)('trace'),
147
- (0, index_js_1.toLogLevel)('planck')
148
- ];
149
- expect(actual).toEqual([
150
- 100, 200, 300, 400, 500, 600, 700, 800, 900, Infinity
151
- ]);
152
- });
153
- test('get custom log level', function () {
154
- (0, index_js_1.addCustomLogLevel)('cust-get', 123);
155
- expect((0, index_js_1.toLogLevel)('cust-get')).toBe(123);
156
- });
157
- test('case insensitive', function () {
158
- var actual = [
159
- (0, index_js_1.toLogLevel)('emerGency'),
160
- (0, index_js_1.toLogLevel)('aleRt'),
161
- (0, index_js_1.toLogLevel)('critIcal'),
162
- (0, index_js_1.toLogLevel)('errOr'),
163
- (0, index_js_1.toLogLevel)('warN'),
164
- (0, index_js_1.toLogLevel)('nOtice'),
165
- (0, index_js_1.toLogLevel)('iNfo'),
166
- (0, index_js_1.toLogLevel)('deBug'),
167
- (0, index_js_1.toLogLevel)('traCe'),
168
- (0, index_js_1.toLogLevel)('planCk')
169
- ];
170
- expect(actual).toEqual([
171
- 100, 200, 300, 400, 500, 600, 700, 800, 900, Infinity
172
- ]);
173
- });
174
- });
175
- describe('getAllLogLevels', function () {
176
- test('get all default log levels except none and all', function () {
177
- var actual = (0, index_js_1.getAllLogLevels)();
178
- (0, type_plus_1.forEachKey)(index_js_1.logLevels, function (name) {
179
- if (name === 'none' || name === 'all') {
180
- expect(actual.find(function (x) { return x.name === name; })).toBeUndefined();
181
- }
182
- else {
183
- expect(actual.find(function (x) { return x.name === name; })).toEqual({ name: name, level: index_js_1.logLevels[name] });
184
- }
185
- });
186
- });
187
- test('include custom level (even if they have the same level value as one of the default level)', function () {
188
- (0, index_js_1.addCustomLogLevel)('info_a', 301);
189
- (0, index_js_1.addCustomLogLevel)('info_b', index_js_1.logLevels.info);
190
- var actual = (0, index_js_1.getAllLogLevels)();
191
- expect(actual.find(function (x) { return x.name === 'info_a'; })).toEqual({ name: 'info_a', level: 301 });
192
- expect(actual.find(function (x) { return x.name === 'info_b'; })).toEqual({ name: 'info_b', level: index_js_1.logLevels.info });
193
- });
194
- });
195
- //# sourceMappingURL=logLevel.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logLevel.spec.js","sourceRoot":"","sources":["../ts/logLevel.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAsB;AACtB,uCAAsC;AACtC,uCAA8K;AAC9K,uCAAkC;AAClC,6CAA+D;AAE/D,SAAS,mBAAmB;IAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;QAC3B,IAAA,oBAAS,EAAC,QAAQ,GAAG,CAAC,CAAC,CAAA;QACvB,IAAA,oBAAS,EAAC,SAAS,GAAG,MAAM,CAAC,YAAY,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAA;KACnD;AACH,CAAC;AAED,SAAS,CAAC;IACR,mBAAmB,EAAE,CAAA;AACvB,CAAC,CAAC,CAAA;AAEF,QAAQ,CAAC;IACP,gBAAK,CAAC,KAAK,EAAE,CAAA;AACf,CAAC,CAAC,CAAA;AAEF,QAAQ,CAAC,4BAA4B,EAAE;IACrC,IAAI,OAA6C,CAAA;IACjD,UAAU,CAAC;QACT,gBAAK,CAAC,KAAK,CAAC,IAAI,GAAG,MAAM,CAAA;QACzB,gBAAK,CAAC,KAAK,CAAC,QAAQ,GAAG,oBAAS,CAAC,KAAK,CAAA;QACtC,OAAO,GAAG,IAAA,+BAAiB,GAAE,CAAA;IAC/B,CAAC,CAAC,CAAA;IACF,SAAS,CAAC;QACR,OAAO,CAAC,KAAK,EAAE,CAAA;IACjB,CAAC,CAAC,CAAA;IACF,IAAI,CAAC,8BAA8B,EAAE;;;YACnC,IAAA,uBAAY,EAAC,GAAG,EAAE,oBAAS,CAAC,KAAK,CAAC,CAAA;YAC5B,GAAG,GAAG,IAAA,oBAAS,EAAC,SAAS,CAAC,CAAA;YA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CAAC,CAAA;QAC3C,IAAM,MAAM,GAAG,IAAA,0BAAe,GAAE,CAAA;QAChC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAnB,CAAmB,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;QACrF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAnB,CAAmB,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,oBAAS,CAAC,IAAI,EAAE,CAAC,CAAA;IAClG,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import t from 'assert'\nimport { forEachKey } from 'type-plus'\nimport { addCustomLogLevel, clearCustomLogLevel, getAllLogLevels, getLogger, getLogLevel, logLevels, setLogLevel, setLogLevels, toLogLevel, toLogLevelName } from './index.js'\nimport { store } from './store.js'\nimport { captureWrittenLog, rangeEntries } from './testUtil.js'\n\nfunction createFilterLoggers() {\n for (let i = 0; i < 20; i++) {\n getLogger('filter' + i)\n getLogger('filter-' + String.fromCharCode(97 + i))\n }\n}\n\nbeforeAll(() => {\n createFilterLoggers()\n})\n\nafterAll(() => {\n store.reset()\n})\n\ndescribe('capture write to reporters', () => {\n let capture: ReturnType<typeof captureWrittenLog>\n beforeEach(() => {\n store.value.mode = 'test'\n store.value.logLevel = logLevels.error\n capture = captureWrittenLog()\n })\n afterEach(() => {\n capture.reset()\n })\n test('no matched logger do no harm', async () => {\n setLogLevels(/x/, logLevels.debug)\n const log = getLogger('filter1')\n log.debug('abc')\n\n expect(capture.logs.length).toEqual(0)\n })\n describe('setLogLevels()', () => {\n beforeEach(() => {\n setLogLevel(logLevels.none)\n })\n test('only filtered log are affected', async () => {\n const logs = setLogLevels(/filter1/, logLevels.debug)\n t.deepStrictEqual(logs.map(l => l.id), [\n 'filter1',\n 'filter10',\n 'filter11',\n 'filter12',\n 'filter13',\n 'filter14',\n 'filter15',\n 'filter16',\n 'filter17',\n 'filter18',\n 'filter19'\n ])\n\n getLogger('filter1').debug('filter1')\n getLogger('filter2').debug('filter2')\n getLogger('filter11').debug('filter11')\n\n t.strictEqual(capture.logs.length, 2)\n })\n })\n})\n\ndescribe('getLogLevel', () => {\n test('default to debug in test mode', () => {\n store.value.mode = 'test'\n store.value.logLevel = logLevels.debug\n expect(getLogLevel()).toBe(logLevels.debug)\n })\n})\n\ndescribe('toLogLevelName()', () => {\n test.each([\n ...rangeEntries(99, 100, 'emergency'),\n ...rangeEntries(199, 200, 'alert'),\n ...rangeEntries(299, 300, 'critical'),\n ...rangeEntries(399, 400, 'error'),\n ...rangeEntries(499, 500, 'warn'),\n ...rangeEntries(599, 600, 'notice'),\n ...rangeEntries(699, 700, 'info'),\n ...rangeEntries(799, 800, 'debug'),\n ...rangeEntries(899, 900, 'trace'),\n ...rangeEntries(9999999, 10000000, 'planck')\n ])('convert %i to %s', (level: number, logLevel: string) => {\n expect(toLogLevelName(level)).toBe(logLevel)\n })\n\n test('get custom log level name', () => {\n addCustomLogLevel('cust-name', 144)\n expect(toLogLevelName(144)).toBe('cust-name')\n })\n})\n\ndescribe('toLogLevel()', () => {\n afterEach(() => clearCustomLogLevel())\n test('get default log levels', () => {\n const actual = [\n toLogLevel('emergency'),\n toLogLevel('alert'),\n toLogLevel('critical'),\n toLogLevel('error'),\n toLogLevel('warn'),\n toLogLevel('notice'),\n toLogLevel('info'),\n toLogLevel('debug'),\n toLogLevel('trace'),\n toLogLevel('planck')\n ]\n expect(actual).toEqual([\n 100, 200, 300, 400, 500, 600, 700, 800, 900, Infinity\n ])\n })\n\n test('get custom log level', () => {\n addCustomLogLevel('cust-get', 123)\n expect(toLogLevel('cust-get')).toBe(123)\n })\n\n test('case insensitive', () => {\n const actual = [\n toLogLevel('emerGency'),\n toLogLevel('aleRt'),\n toLogLevel('critIcal'),\n toLogLevel('errOr'),\n toLogLevel('warN'),\n toLogLevel('nOtice'),\n toLogLevel('iNfo'),\n toLogLevel('deBug'),\n toLogLevel('traCe'),\n toLogLevel('planCk')\n ]\n expect(actual).toEqual([\n 100, 200, 300, 400, 500, 600, 700, 800, 900, Infinity\n ])\n })\n})\n\ndescribe('getAllLogLevels', () => {\n test('get all default log levels except none and all', () => {\n const actual = getAllLogLevels()\n forEachKey(logLevels, name => {\n if (name === 'none' || name === 'all') {\n expect(actual.find(x => x.name === name)).toBeUndefined()\n }\n else {\n expect(actual.find(x => x.name === name)).toEqual({ name, level: logLevels[name] })\n }\n })\n })\n test('include custom level (even if they have the same level value as one of the default level)', () => {\n addCustomLogLevel('info_a', 301)\n addCustomLogLevel('info_b', logLevels.info)\n const actual = getAllLogLevels()\n expect(actual.find(x => x.name === 'info_a')).toEqual({ name: 'info_a', level: 301 })\n expect(actual.find(x => x.name === 'info_b')).toEqual({ name: 'info_b', level: logLevels.info })\n })\n})\n"]}
@@ -1,20 +0,0 @@
1
- import { Logger } from './types.js';
2
- /**
3
- * Gets the overall log level.
4
- */
5
- export declare function getLogLevel(): number;
6
- /**
7
- * Sets the overall log level.
8
- * If the logger has its own local log level,
9
- * that will take precedent.
10
- */
11
- export declare function setLogLevel(level: number): void;
12
- /**
13
- * Sets log levels on specific loggers.
14
- * This will override the local log level of the loggers.
15
- */
16
- export declare function setLogLevels(filter: RegExp, level: number): Logger<any>[];
17
- export declare function toLogLevel(name: string): number | undefined;
18
- export declare function toLogLevelName(level: number): string;
19
- export declare function getAllLogLevels(): import("./types.js").LogLevelEntry[];
20
- //# sourceMappingURL=logLevelFn.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logLevelFn.d.ts","sourceRoot":"","sources":["../ts/logLevelFn.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC;;GAEG;AACH,wBAAgB,WAAW,WAE1B;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,QAExC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,CAKzE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE3D;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,UAyB3C;AAED,wBAAgB,eAAe,yCAM9B"}
package/cjs/logLevelFn.js DELETED
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAllLogLevels = exports.toLogLevelName = exports.toLogLevel = exports.setLogLevels = exports.setLogLevel = exports.getLogLevel = void 0;
4
- var type_plus_1 = require("type-plus");
5
- var customLogLevel_js_1 = require("./customLogLevel.js");
6
- var getLoggers_js_1 = require("./getLoggers.js");
7
- var logLevel_js_1 = require("./logLevel.js");
8
- var store_js_1 = require("./store.js");
9
- /**
10
- * Gets the overall log level.
11
- */
12
- function getLogLevel() {
13
- return store_js_1.store.value.logLevel;
14
- }
15
- exports.getLogLevel = getLogLevel;
16
- /**
17
- * Sets the overall log level.
18
- * If the logger has its own local log level,
19
- * that will take precedent.
20
- */
21
- function setLogLevel(level) {
22
- store_js_1.store.value.logLevel = level;
23
- }
24
- exports.setLogLevel = setLogLevel;
25
- /**
26
- * Sets log levels on specific loggers.
27
- * This will override the local log level of the loggers.
28
- */
29
- function setLogLevels(filter, level) {
30
- return (0, getLoggers_js_1.getLoggers)(filter).map(function (log) {
31
- log.level = level;
32
- return log;
33
- });
34
- }
35
- exports.setLogLevels = setLogLevels;
36
- function toLogLevel(name) {
37
- return (0, customLogLevel_js_1.getCustomLevel)(name) || logLevel_js_1.logLevels[name.toLowerCase()];
38
- }
39
- exports.toLogLevel = toLogLevel;
40
- function toLogLevelName(level) {
41
- var custom = (0, customLogLevel_js_1.getCustomLevelName)(level);
42
- if (custom)
43
- return custom;
44
- switch (true) {
45
- case (level <= 100):
46
- return 'emergency';
47
- case (level <= 200):
48
- return 'alert';
49
- case (level <= 300):
50
- return 'critical';
51
- case (level <= 400):
52
- return 'error';
53
- case (level <= 500):
54
- return 'warn';
55
- case (level <= 600):
56
- return 'notice';
57
- case (level <= 700):
58
- return 'info';
59
- case (level <= 800):
60
- return 'debug';
61
- case (level <= 900):
62
- return 'trace';
63
- default:
64
- return 'planck';
65
- }
66
- }
67
- exports.toLogLevelName = toLogLevelName;
68
- function getAllLogLevels() {
69
- return (0, type_plus_1.reduceKey)(logLevel_js_1.logLevels, function (result, name) {
70
- if (name !== 'none' && name !== 'all')
71
- result.push({ name: name, level: logLevel_js_1.logLevels[name] });
72
- return result;
73
- }, (0, customLogLevel_js_1.getCustomLevels)());
74
- }
75
- exports.getAllLogLevels = getAllLogLevels;
76
- //# sourceMappingURL=logLevelFn.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logLevelFn.js","sourceRoot":"","sources":["../ts/logLevelFn.ts"],"names":[],"mappings":";;;AAAA,uCAAqC;AACrC,yDAAyF;AACzF,iDAA4C;AAC5C,6CAAyC;AACzC,uCAAkC;AAGlC;;GAEG;AACH,SAAgB,WAAW;IACzB,OAAO,gBAAK,CAAC,KAAK,CAAC,QAAQ,CAAA;AAC7B,CAAC;AAFD,kCAEC;AAED;;;;GAIG;AACH,SAAgB,WAAW,CAAC,KAAa;IACvC,gBAAK,CAAC,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAA;AAC9B,CAAC;AAFD,kCAEC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAC,MAAc,EAAE,KAAa;IACxD,OAAO,IAAA,0BAAU,EAAC,MAAM,CAAC,CAAC,GAAG,CAAC,UAAA,GAAG;QAC/B,GAAG,CAAC,KAAK,GAAG,KAAK,CAAA;QACjB,OAAO,GAAG,CAAA;IACZ,C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AC,IAAI,CAAC,EAAE,CAAC,CAAA;QAEpF,OAAO,MAAM,CAAA;IACf,CAAC,EAAE,IAAA,mCAAe,GAAE,CAAC,CAAA;AACvB,CAAC;AAND,0CAMC","sourcesContent":["import { reduceKey } from 'type-plus'\nimport { getCustomLevel, getCustomLevelName, getCustomLevels } from './customLogLevel.js'\nimport { getLoggers } from './getLoggers.js'\nimport { logLevels } from './logLevel.js'\nimport { store } from './store.js'\nimport { Logger } from './types.js'\n\n/**\n * Gets the overall log level.\n */\nexport function getLogLevel() {\n return store.value.logLevel\n}\n\n/**\n * Sets the overall log level.\n * If the logger has its own local log level,\n * that will take precedent.\n */\nexport function setLogLevel(level: number) {\n store.value.logLevel = level\n}\n\n/**\n * Sets log levels on specific loggers.\n * This will override the local log level of the loggers.\n */\nexport function setLogLevels(filter: RegExp, level: number): Logger<any>[] {\n return getLoggers(filter).map(log => {\n log.level = level\n return log\n })\n}\n\nexport function toLogLevel(name: string): number | undefined {\n return getCustomLevel(name) || (logLevels as any)[name.toLowerCase()]\n}\n\nexport function toLogLevelName(level: number) {\n const custom = getCustomLevelName(level)\n if (custom) return custom\n switch (true) {\n case (level <= 100):\n return 'emergency'\n case (level <= 200):\n return 'alert'\n case (level <= 300):\n return 'critical'\n case (level <= 400):\n return 'error'\n case (level <= 500):\n return 'warn'\n case (level <= 600):\n return 'notice'\n case (level <= 700):\n return 'info'\n case (level <= 800):\n return 'debug'\n case (level <= 900):\n return 'trace'\n default:\n return 'planck'\n }\n}\n\nexport function getAllLogLevels() {\n return reduceKey(logLevels, (result, name) => {\n if (name !== 'none' && name !== 'all') result.push({ name, level: logLevels[name] })\n\n return result\n }, getCustomLevels())\n}\n"]}
@@ -1,7 +0,0 @@
1
- import { LogReporter } from './types.js';
2
- export declare function addLogReporter(reporter: LogReporter): void;
3
- export declare function getLogReporter(id: string): LogReporter<any> | undefined;
4
- export declare function hasConsoleReporter(): boolean;
5
- export declare function getConsoleReporter(): LogReporter<any> | undefined;
6
- export declare function clearLogReporters(): void;
7
- //# sourceMappingURL=logReporter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logReporter.d.ts","sourceRoot":"","sources":["../ts/logReporter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAGxC,wBAAgB,cAAc,CAAC,QAAQ,EAAE,WAAW,QAGnD;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,gCAExC;AAED,wBAAgB,kBAAkB,YAEjC;AAED,wBAAgB,kBAAkB,iCAEjC;AAED,wBAAgB,iBAAiB,SAGhC"}
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.clearLogReporters = exports.getConsoleReporter = exports.hasConsoleReporter = exports.getLogReporter = exports.addLogReporter = void 0;
4
- var logReporterInternal_js_1 = require("./logReporterInternal.js");
5
- var store_js_1 = require("./store.js");
6
- var utils_js_1 = require("./utils.js");
7
- function addLogReporter(reporter) {
8
- (0, utils_js_1.assertLogModeIsNotProduction)('addLogReporter');
9
- (0, logReporterInternal_js_1.addLogReporterInternal)(reporter);
10
- }
11
- exports.addLogReporter = addLogReporter;
12
- function getLogReporter(id) {
13
- return store_js_1.store.value.reporters.find(function (r) { return r.id === id; });
14
- }
15
- exports.getLogReporter = getLogReporter;
16
- function hasConsoleReporter() {
17
- return store_js_1.store.value.reporters.some(function (r) { return r.isConsoleReporter; });
18
- }
19
- exports.hasConsoleReporter = hasConsoleReporter;
20
- function getConsoleReporter() {
21
- return store_js_1.store.value.reporters.find(function (r) { return r.isConsoleReporter; });
22
- }
23
- exports.getConsoleReporter = getConsoleReporter;
24
- function clearLogReporters() {
25
- (0, utils_js_1.assertLogModeIsNotProduction)('clearLogReporters');
26
- store_js_1.store.value.reporters.splice(0, store_js_1.store.value.reporters.length);
27
- }
28
- exports.clearLogReporters = clearLogReporters;
29
- //# sourceMappingURL=logReporter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logReporter.js","sourceRoot":"","sources":["../ts/logReporter.ts"],"names":[],"mappings":";;;AAAA,mEAAiE;AACjE,uCAAkC;AAElC,uCAAyD;AAEzD,SAAgB,cAAc,CAAC,QAAqB;IAClD,IAAA,uCAA4B,EAAC,gBAAgB,CAAC,CAAA;IAC9C,IAAA,+CAAsB,EAAC,QAAQ,CAAC,CAAA;AAClC,CAAC;AAHD,wCAGC;AAED,SAAgB,cAAc,CAAC,EAAU;IACvC,OAAO,gBAAK,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,EAAE,KAAK,EAAE,EAAX,CAAW,CAAC,CAAA;AACrD,CAAC;AAFD,wCAEC;AAED,SAAgB,kBAAkB;IAChC,OAAO,gBAAK,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,iBAAiB,EAAnB,CAAmB,CAAC,CAAA;AAC7D,CAAC;AAFD,gDAEC;AAED,SAAgB,kBAAkB;IAChC,OAAO,gBAAK,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,iBAAiB,EAAnB,CAAmB,CAAC,CAAA;AAC7D,CAAC;AAFD,gDAEC;AAED,SAAgB,iBAAiB;IAC/B,IAAA,uCAA4B,EAAC,mBAAmB,CAAC,CAAA;IACjD,gBAAK,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,gBAAK,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;AAC/D,CAAC;AAHD,8CAGC","sourcesContent":["import { addLogReporterInternal } from './logReporterInternal.js'\nimport { store } from './store.js'\nimport { LogReporter } from './types.js'\nimport { assertLogModeIsNotProduction } from './utils.js'\n\nexport function addLogReporter(reporter: LogReporter) {\n assertLogModeIsNotProduction('addLogReporter')\n addLogReporterInternal(reporter)\n}\n\nexport function getLogReporter(id: string) {\n return store.value.reporters.find(r => r.id === id)\n}\n\nexport function hasConsoleReporter() {\n return store.value.reporters.some(r => r.isConsoleReporter)\n}\n\nexport function getConsoleReporter() {\n return store.value.reporters.find(r => r.isConsoleReporter)\n}\n\nexport function clearLogReporters() {\n assertLogModeIsNotProduction('clearLogReporters')\n store.value.reporters.splice(0, store.value.reporters.length)\n}\n"]}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=logReporter.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"logReporter.spec.d.ts","sourceRoot":"","sources":["../ts/logReporter.spec.ts"],"names":[],"mappings":""}
@@ -1,86 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- var assertron_1 = __importDefault(require("assertron"));
7
- var index_js_1 = require("./index.js");
8
- var store_js_1 = require("./store.js");
9
- describe('production checks', function () {
10
- beforeEach(function () { return store_js_1.store.reset(); });
11
- describe('addLogReporter()', function () {
12
- test('throws in production mode', function () {
13
- (0, index_js_1.config)({ mode: 'production' });
14
- var reporter = (0, index_js_1.createMemoryLogReporter)();
15
- assertron_1.default.throws(function () { return (0, index_js_1.addLogReporter)(reporter); }, index_js_1.ProhibitedDuringProduction);
16
- });
17
- });
18
- describe('clearLogReporters()', function () {
19
- test('throws in production mode', function () {
20
- (0, index_js_1.config)({ mode: 'production' });
21
- assertron_1.default.throws(function () { return (0, index_js_1.clearLogReporters)(); }, index_js_1.ProhibitedDuringProduction);
22
- });
23
- });
24
- });
25
- describe('unit tests', function () {
26
- beforeEach(function () {
27
- store_js_1.store.reset();
28
- (0, index_js_1.config)({ mode: 'test' });
29
- });
30
- describe('addLogReporter()', function () {
31
- test('adds log reporter', function () {
32
- var count = store_js_1.store.value.reporters.length;
33
- var reporter = (0, index_js_1.createMemoryLogReporter)();
34
- (0, index_js_1.addLogReporter)(reporter);
35
- expect(store_js_1.store.value.reporters.length).toBe(count + 1);
36
- });
37
- describe('add another console reporter', function () {
38
- test('will not replace existing one', function () {
39
- expect((0, index_js_1.getLogReporter)('console')).toBeDefined();
40
- (0, index_js_1.addLogReporter)((0, index_js_1.createConsoleLogReporter)({ id: 'c2' }));
41
- expect((0, index_js_1.getLogReporter)('c2')).toBeUndefined();
42
- expect((0, index_js_1.getLogReporter)('console')).toBeDefined();
43
- });
44
- test('will carry over existing filter', function () {
45
- var filter = function (entry) { return entry.level < index_js_1.logLevels.alert; };
46
- (0, index_js_1.addLogReporter)((0, index_js_1.createConsoleLogReporter)({ id: 'c2', filter: filter }));
47
- (0, index_js_1.addLogReporter)((0, index_js_1.createConsoleLogReporter)({ id: 'c3' }));
48
- var c3 = (0, index_js_1.getConsoleReporter)();
49
- expect(c3.filter).toBe(filter);
50
- });
51
- test('will combine existing filter and new filter', function () {
52
- (0, index_js_1.addLogReporter)((0, index_js_1.createConsoleLogReporter)({ id: 'c2', filter: function (entry) { return entry.level > index_js_1.logLevels.critical; } }));
53
- (0, index_js_1.addLogReporter)((0, index_js_1.createConsoleLogReporter)({ id: 'c3', filter: function (entry) { return entry.level < index_js_1.logLevels.error; } }));
54
- var c2 = (0, index_js_1.getConsoleReporter)();
55
- expect(c2.filter({ level: index_js_1.logLevels.info })).toBe(false);
56
- expect(c2.filter({ level: index_js_1.logLevels.alert })).toBe(false);
57
- });
58
- });
59
- });
60
- describe('getLogReporter()', function () {
61
- test('get log reporter by id', function () {
62
- expect((0, index_js_1.getLogReporter)('console')).toBeDefined();
63
- });
64
- test('get log reporter with unknown id gets undefined', function () {
65
- expect((0, index_js_1.getLogReporter)('blah')).toBeUndefined();
66
- });
67
- });
68
- describe('clearLogReporters()', function () {
69
- test('removes all reporters', function () {
70
- (0, index_js_1.clearLogReporters)();
71
- expect(store_js_1.store.value.reporters.length).toBe(0);
72
- });
73
- });
74
- describe('hasConsoleReporter()', function () {
75
- test('returns true if there is a console reporter', function () {
76
- expect((0, index_js_1.hasConsoleReporter)()).toBeTruthy();
77
- });
78
- test('returns false if there is no console reporter', function () {
79
- (0, index_js_1.clearLogReporters)();
80
- expect((0, index_js_1.hasConsoleReporter)()).toBeFalsy();
81
- (0, index_js_1.addLogReporter)((0, index_js_1.createMemoryLogReporter)());
82
- expect((0, index_js_1.hasConsoleReporter)()).toBeFalsy();
83
- });
84
- });
85
- });
86
- //# sourceMappingURL=logReporter.spec.js.map