@aneuhold/core-ts-lib 2.0.10 → 2.1.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 (43) hide show
  1. package/lib/index.d.ts +5 -3
  2. package/lib/index.d.ts.map +1 -1
  3. package/lib/index.js +2 -2
  4. package/lib/index.js.map +1 -1
  5. package/lib/index.ts +6 -3
  6. package/lib/interfaces/ILogger.d.ts +48 -0
  7. package/lib/interfaces/ILogger.d.ts.map +1 -0
  8. package/lib/interfaces/ILogger.js +15 -0
  9. package/lib/interfaces/ILogger.js.map +1 -0
  10. package/lib/interfaces/ILogger.ts +55 -0
  11. package/lib/interfaces/ITracer.d.ts +79 -0
  12. package/lib/interfaces/ITracer.d.ts.map +1 -0
  13. package/lib/interfaces/ITracer.js +32 -0
  14. package/lib/interfaces/ITracer.js.map +1 -0
  15. package/lib/interfaces/ITracer.ts +102 -0
  16. package/lib/services/DependencyRegistry.d.ts +43 -0
  17. package/lib/services/DependencyRegistry.d.ts.map +1 -0
  18. package/lib/services/DependencyRegistry.js +52 -0
  19. package/lib/services/DependencyRegistry.js.map +1 -0
  20. package/lib/services/DependencyRegistry.ts +58 -0
  21. package/lib/services/DependencyService.js +4 -4
  22. package/lib/services/DependencyService.js.map +1 -1
  23. package/lib/services/DependencyService.ts +4 -4
  24. package/lib/services/FileSystemService/FileSystemService.d.ts +8 -0
  25. package/lib/services/FileSystemService/FileSystemService.d.ts.map +1 -1
  26. package/lib/services/FileSystemService/FileSystemService.js +16 -8
  27. package/lib/services/FileSystemService/FileSystemService.js.map +1 -1
  28. package/lib/services/FileSystemService/FileSystemService.ts +16 -8
  29. package/lib/services/PackageService.js +16 -16
  30. package/lib/services/PackageService.js.map +1 -1
  31. package/lib/services/PackageService.ts +16 -16
  32. package/lib/utils/ConsoleLogger.d.ts +101 -0
  33. package/lib/utils/ConsoleLogger.d.ts.map +1 -0
  34. package/lib/utils/ConsoleLogger.js +146 -0
  35. package/lib/utils/ConsoleLogger.js.map +1 -0
  36. package/lib/utils/ConsoleLogger.ts +161 -0
  37. package/package.json +9 -9
  38. package/readme.md +6 -3
  39. package/lib/utils/Logger.d.ts +0 -95
  40. package/lib/utils/Logger.d.ts.map +0 -1
  41. package/lib/utils/Logger.js +0 -136
  42. package/lib/utils/Logger.js.map +0 -1
  43. package/lib/utils/Logger.ts +0 -146
@@ -1,146 +0,0 @@
1
- /**
2
- * A standard logger that can be used to log messages to the console.
3
- */
4
- export default class Logger {
5
- /**
6
- * Indicates if verbose logging is enabled.
7
- */
8
- public static verboseLoggingEnabled = false;
9
-
10
- /**
11
- * Private variable that sets if any logging on this instance of the Log
12
- * should only log if the `verboseLoggingEnabled` is set to true.
13
- */
14
- private logOnlyIfVerbose = false;
15
-
16
- /**
17
- * Creates an instance of Logger.
18
- *
19
- * @param logOnlyIfVerbose - If true, logging will only occur if verbose logging is enabled.
20
- */
21
- constructor(logOnlyIfVerbose?: boolean) {
22
- if (logOnlyIfVerbose) {
23
- this.logOnlyIfVerbose = logOnlyIfVerbose;
24
- }
25
- }
26
-
27
- /**
28
- * Sets the logging of the next chained function to only be activated
29
- * if verbose logging is turned on.
30
- *
31
- * @returns A new Logger instance with verbose logging enabled.
32
- */
33
- static get verbose(): Logger {
34
- return new Logger(true);
35
- }
36
-
37
- /**
38
- * Logs info to the console. Prepends `ℹ️` to each message.
39
- *
40
- * @param msg - The message to log.
41
- * @param skipNewline - If true, the message will be logged without a newline.
42
- */
43
- info(msg: string, skipNewline?: boolean): void {
44
- if (this.shouldLog()) {
45
- const printMessage = `ℹ️ ${msg}`;
46
- if (skipNewline) {
47
- process.stdout.write(printMessage);
48
- } else {
49
- console.log(printMessage);
50
- }
51
- }
52
- }
53
-
54
- /**
55
- * Static version of {@link Logger.prototype.info}.
56
- *
57
- * @param msg - The message to log.
58
- * @param skipNewline - If true, the message will be logged without a newline.
59
- * @see Logger.prototype.info
60
- */
61
- static info(msg: string, skipNewline?: boolean): void {
62
- new Logger().info(msg, skipNewline);
63
- }
64
-
65
- /**
66
- * Logs a success message to the console. Prepends `✅` to each message.
67
- *
68
- * @param msg - The message to log.
69
- */
70
- success(msg: string): void {
71
- if (this.shouldLog()) {
72
- console.log(`✅ ${msg}`);
73
- }
74
- }
75
-
76
- /**
77
- * Static version of {@link Logger.prototype.success}.
78
- *
79
- * @param msg - The message to log.
80
- * @see Logger.prototype.success
81
- */
82
- static success(msg: string): void {
83
- new Logger().success(msg);
84
- }
85
-
86
- /**
87
- * Logs a failure message to the console. Prepends `🔴` to each message.
88
- *
89
- * See {@link error} for logging errors.
90
- *
91
- * This doesn't use a `console.error` entry. Just a `console.log` entry.
92
- *
93
- * @param msg - The message to log.
94
- */
95
- failure(msg: string): void {
96
- if (this.shouldLog()) {
97
- console.log(`🔴 ${msg}`);
98
- }
99
- }
100
-
101
- /**
102
- * Static version of {@link Logger.prototype.failure}.
103
- *
104
- * @param msg - The message to log.
105
- * @see Logger.prototype.failure
106
- */
107
- static failure(msg: string): void {
108
- new Logger().failure(msg);
109
- }
110
-
111
- /**
112
- * Logs an error message to the console. Only use this for errors that will
113
- * likely stop execution. Prepends `💀` to each message and uses `console.error`.
114
- *
115
- * See {@link failure} for logging simple failures.
116
- *
117
- * @param msg - The message to log.
118
- */
119
- error(msg: string): void {
120
- if (this.shouldLog()) {
121
- console.error(`💀 ${msg}`);
122
- }
123
- }
124
-
125
- /**
126
- * Static version of {@link Logger.prototype.error}.
127
- *
128
- * @param msg - The message to log.
129
- * @see Logger.prototype.error
130
- */
131
- static error(msg: string): void {
132
- new Logger().error(msg);
133
- }
134
-
135
- /**
136
- * Determines if the message should be logged based on the verbose logging settings.
137
- *
138
- * @returns True if the message should be logged, false otherwise.
139
- */
140
- private shouldLog(): boolean {
141
- if (!this.logOnlyIfVerbose || Logger.verboseLoggingEnabled) {
142
- return true;
143
- }
144
- return false;
145
- }
146
- }