@darksheep/logger 1.0.0

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 (61) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +191 -0
  3. package/package.json +44 -0
  4. package/src/create-logger.js +36 -0
  5. package/src/formatter.js +14 -0
  6. package/src/formatters/formatter-console.js +243 -0
  7. package/src/formatters/formatter-json.js +7 -0
  8. package/src/index.js +25 -0
  9. package/src/logger.js +369 -0
  10. package/src/replacer.js +68 -0
  11. package/src/replacers/buffers.js +18 -0
  12. package/src/replacers/error.js +40 -0
  13. package/src/replacers/http-client-request.js +18 -0
  14. package/src/replacers/http-incoming-message.js +26 -0
  15. package/src/replacers/http-server-response.js +16 -0
  16. package/src/replacers/index.js +8 -0
  17. package/src/replacers/long-strings.js +11 -0
  18. package/src/replacers/net-socket.js +21 -0
  19. package/src/replacers/secrets.js +50 -0
  20. package/src/stdout-write.js +7 -0
  21. package/src/utilities/colour.js +152 -0
  22. package/src/utilities/environment.js +61 -0
  23. package/src/utilities/json-path.js +17 -0
  24. package/src/utilities/last-callsite.js +11 -0
  25. package/src/utilities/log-filters.js +22 -0
  26. package/src/utilities/log-types.js +46 -0
  27. package/src/utilities/parse-filters.js +47 -0
  28. package/src/utilities/parse-log-level.js +32 -0
  29. package/src/utilities/stacktrace.js +57 -0
  30. package/types/assert.zod.d.ts +18 -0
  31. package/types/create-logger.d.ts +5 -0
  32. package/types/formatter.d.ts +6 -0
  33. package/types/formatters/formatter-console.d.ts +9 -0
  34. package/types/formatters/formatter-json.d.ts +5 -0
  35. package/types/index.d.ts +11 -0
  36. package/types/logger.d.ts +184 -0
  37. package/types/logger.test.d.ts +1 -0
  38. package/types/replacer.d.ts +45 -0
  39. package/types/replacer.test.d.ts +1 -0
  40. package/types/replacers/buffers.d.ts +2 -0
  41. package/types/replacers/buffers.test.d.ts +1 -0
  42. package/types/replacers/error.d.ts +37 -0
  43. package/types/replacers/error.test.d.ts +1 -0
  44. package/types/replacers/http-client-request.d.ts +3 -0
  45. package/types/replacers/http-client-request.test.d.ts +1 -0
  46. package/types/replacers/http-incoming-message.d.ts +15 -0
  47. package/types/replacers/http-server-response.d.ts +3 -0
  48. package/types/replacers/index.d.ts +8 -0
  49. package/types/replacers/long-strings.d.ts +2 -0
  50. package/types/replacers/net-socket.d.ts +3 -0
  51. package/types/replacers/secrets.d.ts +4 -0
  52. package/types/stdout-write.d.ts +5 -0
  53. package/types/utilities/colour.d.ts +76 -0
  54. package/types/utilities/environment.d.ts +25 -0
  55. package/types/utilities/json-path.d.ts +5 -0
  56. package/types/utilities/last-callsite.d.ts +9 -0
  57. package/types/utilities/log-filters.d.ts +12 -0
  58. package/types/utilities/log-types.d.ts +126 -0
  59. package/types/utilities/parse-filters.d.ts +9 -0
  60. package/types/utilities/parse-log-level.d.ts +7 -0
  61. package/types/utilities/stacktrace.d.ts +59 -0
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @typedef {Object} Callsite
3
+ * @property {string} file The file name for the callsite
4
+ * @property {string} [relativePath] The relative path for the callsite.file
5
+ * @property {string} [absolutePath] The absolute path for the callsite.file
6
+ * @property {string} methodName The methodName from the callsite
7
+ * @property {number} line The line number in the file
8
+ * @property {number} column The column number in the file
9
+ */
10
+ /**
11
+ * Get the callsite that we think is outside the package
12
+ * @param {string} [stack] The stacktrace to parse
13
+ * @returns {Callsite[]}
14
+ */
15
+ export function parseStack(stack?: string | undefined): Callsite[];
16
+ export type Callsite = {
17
+ /**
18
+ * The file name for the callsite
19
+ */
20
+ /**
21
+ * The file name for the callsite
22
+ */
23
+ file: string;
24
+ /**
25
+ * The relative path for the callsite.file
26
+ */
27
+ /**
28
+ * The relative path for the callsite.file
29
+ */
30
+ relativePath?: string | undefined;
31
+ /**
32
+ * The absolute path for the callsite.file
33
+ */
34
+ /**
35
+ * The absolute path for the callsite.file
36
+ */
37
+ absolutePath?: string | undefined;
38
+ /**
39
+ * The methodName from the callsite
40
+ */
41
+ /**
42
+ * The methodName from the callsite
43
+ */
44
+ methodName: string;
45
+ /**
46
+ * The line number in the file
47
+ */
48
+ /**
49
+ * The line number in the file
50
+ */
51
+ line: number;
52
+ /**
53
+ * The column number in the file
54
+ */
55
+ /**
56
+ * The column number in the file
57
+ */
58
+ column: number;
59
+ };