@nuov.io/logging 1.1.62

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.
package/README.md ADDED
@@ -0,0 +1,182 @@
1
+ # Logging
2
+
3
+ ## Description
4
+
5
+ **Logging** is a TypeScript module that provides a structured approach to logging in applications and serves as the logging layer for the @nuov.io ecosystem.
6
+
7
+ The `Logger` interface is designed for dependency injection. The `LoggingService` is an abstract singleton service that implements the `Logger` interface and simplifies creating application-wide logging. The `ConsoleLoggingService` is a concrete `Logger` class that writes messages to the console; it is the default logger and a last resort in logging.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @nuov.io/logging
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ### Using `ConsoleLoggingService`
18
+
19
+ `ConsoleLoggingService` is a concrete logger that writes each message to the corresponding console method. It is useful as a default logger or in testing scenarios.
20
+
21
+ ```typescript
22
+ import { ConsoleLoggingService, type Logger } from "@nuov.io/logging";
23
+
24
+ const consoleLoggingService: Logger = new ConsoleLoggingService();
25
+ consoleLoggingService.info("This message will be written to the console");
26
+ ```
27
+
28
+ ### Implementing the `Logger` interface
29
+
30
+ ```typescript
31
+ import { type Logger } from "@nuov.io/logging";
32
+
33
+ class PrefixLogger implements Logger {
34
+ public debug(message: string): void {
35
+ console.debug(`[DEBUG] ${message}`);
36
+ }
37
+
38
+ public error(message: string): void {
39
+ console.error(`[ERROR] ${message}`);
40
+ }
41
+
42
+ public fatal(message: string): void {
43
+ console.error(`[FATAL] ${message}`);
44
+ }
45
+
46
+ public info(message: string): void {
47
+ console.info(`[INFO] ${message}`);
48
+ }
49
+
50
+ public trace(message: string): void {
51
+ console.trace(`[TRACE] ${message}`);
52
+ }
53
+
54
+ public warn(message: string): void {
55
+ console.warn(`[WARN] ${message}`);
56
+ }
57
+ }
58
+
59
+ const prefixLogger: Logger = new PrefixLogger();
60
+ prefixLogger.warn("Something looks suspicious");
61
+ ```
62
+
63
+ ### Extending `LoggingService`
64
+
65
+ `LoggingService` is an abstract singleton base class. Extend it to create a custom logging service, initialize it once at application startup, and access the instance anywhere via the static `instance` getter.
66
+
67
+ ```typescript
68
+ import { type Logger, LoggingService } from "@nuov.io/logging";
69
+
70
+ class ExampleLoggingService extends LoggingService<ExampleLoggingService> {
71
+ public static initialize(): void {
72
+ const exampleLoggingService: ExampleLoggingService =
73
+ new ExampleLoggingService();
74
+ exampleLoggingService.instantiate();
75
+ }
76
+
77
+ public override debug(message: string): void {
78
+ // Custom debug logging logic here
79
+ }
80
+
81
+ public override error(message: string): void {
82
+ // Custom error logging logic here
83
+ }
84
+
85
+ public override fatal(message: string): void {
86
+ // Custom fatal logging logic here
87
+ }
88
+
89
+ public override info(message: string): void {
90
+ // Custom info logging logic here
91
+ }
92
+
93
+ public override trace(message: string): void {
94
+ // Custom trace logging logic here
95
+ }
96
+
97
+ public override warn(message: string): void {
98
+ // Custom warn logging logic here
99
+ }
100
+ }
101
+
102
+ // Initialize once at startup
103
+ ExampleLoggingService.initialize();
104
+
105
+ // Initializing more than once throws an error
106
+ ExampleLoggingService.initialize();
107
+ // throws: "The property 'instance' is not undefined."
108
+
109
+ // Access the singleton
110
+ LoggingService.instance.info("Something happened.");
111
+
112
+ // Create local variable
113
+ const logger: Logger = LoggingService.instance;
114
+ ```
115
+
116
+ ## API Reference
117
+
118
+ ### `Logger` (interface)
119
+
120
+ The contract that all loggers must satisfy.
121
+
122
+ | Method | Returns | Description |
123
+ | ------------------------ | ------- | ------------------------------ |
124
+ | `debug(message: string)` | `void` | Logs a debug message. |
125
+ | `error(message: string)` | `void` | Logs an error message. |
126
+ | `fatal(message: string)` | `void` | Logs a fatal message. |
127
+ | `info(message: string)` | `void` | Logs an informational message. |
128
+ | `trace(message: string)` | `void` | Logs a trace message. |
129
+ | `warn(message: string)` | `void` | Logs a warning message. |
130
+
131
+ ### `ConsoleLoggingService` (class)
132
+
133
+ A concrete implementation of `Logger` that writes messages to the console.
134
+
135
+ #### Constructor
136
+
137
+ ```typescript
138
+ new ConsoleLoggingService();
139
+ ```
140
+
141
+ #### Methods
142
+
143
+ | Method | Returns | Description |
144
+ | ------------------------ | ------- | ----------------------------------- |
145
+ | `debug(message: string)` | `void` | Logs the message via console.debug. |
146
+ | `error(message: string)` | `void` | Logs the message via console.error. |
147
+ | `fatal(message: string)` | `void` | Logs the message via console.error. |
148
+ | `info(message: string)` | `void` | Logs the message via console.info. |
149
+ | `trace(message: string)` | `void` | Logs the message via console.trace. |
150
+ | `warn(message: string)` | `void` | Logs the message via console.warn. |
151
+
152
+ ### `LoggingService<T extends LoggingService<T>>` (abstract class)
153
+
154
+ An abstract singleton base class that implements the `Logger` interface to simplify the creation of application-wide logging services.
155
+
156
+ #### Static Properties
157
+
158
+ | Property | Type | Description |
159
+ | --------------- | --------- | -------------------------------------------------------------------------------------------- |
160
+ | `instance` | `Logger` | Returns the singleton instance. Defaults to a `ConsoleLoggingService` before initialization. |
161
+ | `isInitialized` | `boolean` | Returns `true` if the service has been initialized. |
162
+
163
+ #### Protected Methods
164
+
165
+ | Method | Returns | Description |
166
+ | ------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
167
+ | `instantiate` | `void` | Sets the singleton instance to the subclass (`this`) and is designed to be used within a subclass `initialize` static method. Throws "The property 'instance' is not undefined." if already initialized by any subclass. |
168
+
169
+ #### Abstract Methods
170
+
171
+ | Method | Returns | Description |
172
+ | ------------------------ | ------- | ----------------------------------------------------------------- |
173
+ | `debug(message: string)` | `void` | Logs a debug message. Must be implemented by subclasses. |
174
+ | `error(message: string)` | `void` | Logs an error message. Must be implemented by subclasses. |
175
+ | `fatal(message: string)` | `void` | Logs a fatal message. Must be implemented by subclasses. |
176
+ | `info(message: string)` | `void` | Logs an informational message. Must be implemented by subclasses. |
177
+ | `trace(message: string)` | `void` | Logs a trace message. Must be implemented by subclasses. |
178
+ | `warn(message: string)` | `void` | Logs a warning message. Must be implemented by subclasses. |
179
+
180
+ ## License
181
+
182
+ MIT License
@@ -0,0 +1,37 @@
1
+ import { type Logger } from "./Logger";
2
+ /**
3
+ * The class ConsoleLoggingService.
4
+ */
5
+ export declare class ConsoleLoggingService implements Logger {
6
+ /**
7
+ * Logs a debug message.
8
+ * @param message - The message
9
+ */
10
+ debug(message: string): void;
11
+ /**
12
+ * Logs an error message.
13
+ * @param message - The message
14
+ */
15
+ error(message: string): void;
16
+ /**
17
+ * Logs a fatal message.
18
+ * @param message - The message
19
+ */
20
+ fatal(message: string): void;
21
+ /**
22
+ * Logs an informational message.
23
+ * @param message - The message
24
+ */
25
+ info(message: string): void;
26
+ /**
27
+ * Logs a trace message.
28
+ * @param message - The message
29
+ */
30
+ trace(message: string): void;
31
+ /**
32
+ * Logs a warning message.
33
+ * @param message - The message
34
+ */
35
+ warn(message: string): void;
36
+ }
37
+ //# sourceMappingURL=ConsoleLoggingService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsoleLoggingService.d.ts","sourceRoot":"","sources":["../src/ConsoleLoggingService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;GAEG;AACH,qBAAa,qBAAsB,YAAW,MAAM;IAClD;;;OAGG;IACI,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAInC;;;OAGG;IACI,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAInC;;;OAGG;IACI,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAInC;;;OAGG;IACI,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAIlC;;;OAGG;IACI,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAInC;;;OAGG;IACI,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAGnC"}
@@ -0,0 +1,49 @@
1
+ import {} from "./Logger";
2
+ /**
3
+ * The class ConsoleLoggingService.
4
+ */
5
+ export class ConsoleLoggingService {
6
+ /**
7
+ * Logs a debug message.
8
+ * @param message - The message
9
+ */
10
+ debug(message) {
11
+ console.debug(message);
12
+ }
13
+ /**
14
+ * Logs an error message.
15
+ * @param message - The message
16
+ */
17
+ error(message) {
18
+ console.error(message);
19
+ }
20
+ /**
21
+ * Logs a fatal message.
22
+ * @param message - The message
23
+ */
24
+ fatal(message) {
25
+ console.error(message);
26
+ }
27
+ /**
28
+ * Logs an informational message.
29
+ * @param message - The message
30
+ */
31
+ info(message) {
32
+ console.info(message);
33
+ }
34
+ /**
35
+ * Logs a trace message.
36
+ * @param message - The message
37
+ */
38
+ trace(message) {
39
+ console.trace(message);
40
+ }
41
+ /**
42
+ * Logs a warning message.
43
+ * @param message - The message
44
+ */
45
+ warn(message) {
46
+ console.warn(message);
47
+ }
48
+ }
49
+ //# sourceMappingURL=ConsoleLoggingService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ConsoleLoggingService.js","sourceRoot":"","sources":["../src/ConsoleLoggingService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,UAAU,CAAC;AAEvC;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAChC;;;OAGG;IACI,KAAK,CAAC,OAAe;QAC1B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,OAAe;QAC1B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,OAAe;QAC1B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAED;;;OAGG;IACI,IAAI,CAAC,OAAe;QACzB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,OAAe;QAC1B,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAED;;;OAGG;IACI,IAAI,CAAC,OAAe;QACzB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;CACF","sourcesContent":["import { type Logger } from \"./Logger\";\n\n/**\n * The class ConsoleLoggingService.\n */\nexport class ConsoleLoggingService implements Logger {\n /**\n * Logs a debug message.\n * @param message - The message\n */\n public debug(message: string): void {\n console.debug(message);\n }\n\n /**\n * Logs an error message.\n * @param message - The message\n */\n public error(message: string): void {\n console.error(message);\n }\n\n /**\n * Logs a fatal message.\n * @param message - The message\n */\n public fatal(message: string): void {\n console.error(message);\n }\n\n /**\n * Logs an informational message.\n * @param message - The message\n */\n public info(message: string): void {\n console.info(message);\n }\n\n /**\n * Logs a trace message.\n * @param message - The message\n */\n public trace(message: string): void {\n console.trace(message);\n }\n\n /**\n * Logs a warning message.\n * @param message - The message\n */\n public warn(message: string): void {\n console.warn(message);\n }\n}\n"]}
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2026 Timothy Neill
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,34 @@
1
+ /** The interface Logger. */
2
+ export interface Logger {
3
+ /**
4
+ * Logs a debug message.
5
+ * @param message - The message
6
+ */
7
+ debug(message: string): void;
8
+ /**
9
+ * Logs an error message.
10
+ * @param message - The message
11
+ */
12
+ error(message: string): void;
13
+ /**
14
+ * Logs a fatal message.
15
+ * @param message - The message
16
+ */
17
+ fatal(message: string): void;
18
+ /**
19
+ * Logs an informational message.
20
+ * @param message - The message
21
+ */
22
+ info(message: string): void;
23
+ /**
24
+ * Logs a trace message.
25
+ * @param message - The message
26
+ */
27
+ trace(message: string): void;
28
+ /**
29
+ * Logs a warning message.
30
+ * @param message - The message
31
+ */
32
+ warn(message: string): void;
33
+ }
34
+ //# sourceMappingURL=Logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../src/Logger.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,MAAM,WAAW,MAAM;IACrB;;;OAGG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;;OAGG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;;OAGG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;;OAGG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B;;;OAGG;IACH,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B;;;OAGG;IACH,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B"}
package/dist/Logger.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Logger.js","sourceRoot":"","sources":["../src/Logger.ts"],"names":[],"mappings":"","sourcesContent":["/** The interface Logger. */\nexport interface Logger {\n /**\n * Logs a debug message.\n * @param message - The message\n */\n debug(message: string): void;\n\n /**\n * Logs an error message.\n * @param message - The message\n */\n error(message: string): void;\n\n /**\n * Logs a fatal message.\n * @param message - The message\n */\n fatal(message: string): void;\n\n /**\n * Logs an informational message.\n * @param message - The message\n */\n info(message: string): void;\n\n /**\n * Logs a trace message.\n * @param message - The message\n */\n trace(message: string): void;\n\n /**\n * Logs a warning message.\n * @param message - The message\n */\n warn(message: string): void;\n}\n"]}
@@ -0,0 +1,56 @@
1
+ import { type Logger } from "./Logger";
2
+ /**
3
+ * The class LoggingService.
4
+ * @typeParam T - The LoggingService type
5
+ */
6
+ export declare abstract class LoggingService<T extends LoggingService<T>> implements Logger {
7
+ /** The logging singleton instance. */
8
+ private static _INSTANCE;
9
+ /** The instantiated flag. */
10
+ private static _INSTANTIATED;
11
+ /**
12
+ * Instantiates the logging service.
13
+ */
14
+ protected instantiate(): void;
15
+ /**
16
+ * Gets the logging provider instance.
17
+ * @returns The logging provider
18
+ */
19
+ static get instance(): Logger;
20
+ /**
21
+ * Checks if the logging singleton is initialized.
22
+ * @returns true if the logging singleton is initialized
23
+ */
24
+ static get isInitialized(): boolean;
25
+ /**
26
+ * Logs a debug message.
27
+ * @param message - The message
28
+ */
29
+ abstract debug(message: string): void;
30
+ /**
31
+ * Logs an error message.
32
+ * @param message - The message
33
+ */
34
+ abstract error(message: string): void;
35
+ /**
36
+ * Logs a fatal message.
37
+ * @param message - The message
38
+ */
39
+ abstract fatal(message: string): void;
40
+ /**
41
+ * Logs an informational message.
42
+ * @param message - The message
43
+ */
44
+ abstract info(message: string): void;
45
+ /**
46
+ * Logs a trace message.
47
+ * @param message - The message
48
+ */
49
+ abstract trace(message: string): void;
50
+ /**
51
+ * Logs a warning message.
52
+ * @param message - The message
53
+ */
54
+ abstract warn(message: string): void;
55
+ }
56
+ //# sourceMappingURL=LoggingService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoggingService.d.ts","sourceRoot":"","sources":["../src/LoggingService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC;;;GAGG;AACH,8BAAsB,cAAc,CAClC,CAAC,SAAS,cAAc,CAAC,CAAC,CAAC,CAC3B,YAAW,MAAM;IACjB,sCAAsC;IACtC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAuC;IAE/D,6BAA6B;IAC7B,OAAO,CAAC,MAAM,CAAC,aAAa,CAAkB;IAE9C;;OAEG;IACH,SAAS,CAAC,WAAW,IAAI,IAAI;IAa7B;;;OAGG;IACH,WAAkB,QAAQ,IAAI,MAAM,CAEnC;IAED;;;OAGG;IACH,WAAkB,aAAa,IAAI,OAAO,CAEzC;IAED;;;OAGG;aACa,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAE5C;;;OAGG;aACa,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAE5C;;;OAGG;aACa,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAE5C;;;OAGG;aACa,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAE3C;;;OAGG;aACa,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAE5C;;;OAGG;aACa,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CAC5C"}
@@ -0,0 +1,41 @@
1
+ import { Nouns, Sentence, Superlatives } from "@nuov.io/sentence";
2
+ import { ConsoleLoggingService } from "./ConsoleLoggingService";
3
+ import {} from "./Logger";
4
+ /**
5
+ * The class LoggingService.
6
+ * @typeParam T - The LoggingService type
7
+ */
8
+ export class LoggingService {
9
+ /** The logging singleton instance. */
10
+ static _INSTANCE = new ConsoleLoggingService();
11
+ /** The instantiated flag. */
12
+ static _INSTANTIATED = false;
13
+ /**
14
+ * Instantiates the logging service.
15
+ */
16
+ instantiate() {
17
+ // validate
18
+ if (LoggingService.isInitialized) {
19
+ throw new Error(Sentence.the(Nouns.PROPERTY, "LoggingService.instance")
20
+ .is(Superlatives.ALREADY_ASSIGNED)
21
+ .period());
22
+ }
23
+ LoggingService._INSTANCE = this;
24
+ LoggingService._INSTANTIATED = true;
25
+ }
26
+ /**
27
+ * Gets the logging provider instance.
28
+ * @returns The logging provider
29
+ */
30
+ static get instance() {
31
+ return LoggingService._INSTANCE;
32
+ }
33
+ /**
34
+ * Checks if the logging singleton is initialized.
35
+ * @returns true if the logging singleton is initialized
36
+ */
37
+ static get isInitialized() {
38
+ return LoggingService._INSTANTIATED;
39
+ }
40
+ }
41
+ //# sourceMappingURL=LoggingService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoggingService.js","sourceRoot":"","sources":["../src/LoggingService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAe,MAAM,UAAU,CAAC;AAEvC;;;GAGG;AACH,MAAM,OAAgB,cAAc;IAGlC,sCAAsC;IAC9B,MAAM,CAAC,SAAS,GAAW,IAAI,qBAAqB,EAAE,CAAC;IAE/D,6BAA6B;IACrB,MAAM,CAAC,aAAa,GAAY,KAAK,CAAC;IAE9C;;OAEG;IACO,WAAW;QACnB,WAAW;QACX,IAAI,cAAc,CAAC,aAAa,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CACb,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,yBAAyB,CAAC;iBACpD,EAAE,CAAC,YAAY,CAAC,gBAAgB,CAAC;iBACjC,MAAM,EAAE,CACZ,CAAC;QACJ,CAAC;QACD,cAAc,CAAC,SAAS,GAAG,IAAI,CAAC;QAChC,cAAc,CAAC,aAAa,GAAG,IAAI,CAAC;IACtC,CAAC;IAED;;;OAGG;IACI,MAAM,KAAK,QAAQ;QACxB,OAAO,cAAc,CAAC,SAAS,CAAC;IAClC,CAAC;IAED;;;OAGG;IACI,MAAM,KAAK,aAAa;QAC7B,OAAO,cAAc,CAAC,aAAa,CAAC;IACtC,CAAC","sourcesContent":["import { Nouns, Sentence, Superlatives } from \"@nuov.io/sentence\";\nimport { ConsoleLoggingService } from \"./ConsoleLoggingService\";\nimport { type Logger } from \"./Logger\";\n\n/**\n * The class LoggingService.\n * @typeParam T - The LoggingService type\n */\nexport abstract class LoggingService<\n T extends LoggingService<T>,\n> implements Logger {\n /** The logging singleton instance. */\n private static _INSTANCE: Logger = new ConsoleLoggingService();\n\n /** The instantiated flag. */\n private static _INSTANTIATED: boolean = false;\n\n /**\n * Instantiates the logging service.\n */\n protected instantiate(): void {\n // validate\n if (LoggingService.isInitialized) {\n throw new Error(\n Sentence.the(Nouns.PROPERTY, \"LoggingService.instance\")\n .is(Superlatives.ALREADY_ASSIGNED)\n .period(),\n );\n }\n LoggingService._INSTANCE = this;\n LoggingService._INSTANTIATED = true;\n }\n\n /**\n * Gets the logging provider instance.\n * @returns The logging provider\n */\n public static get instance(): Logger {\n return LoggingService._INSTANCE;\n }\n\n /**\n * Checks if the logging singleton is initialized.\n * @returns true if the logging singleton is initialized\n */\n public static get isInitialized(): boolean {\n return LoggingService._INSTANTIATED;\n }\n\n /**\n * Logs a debug message.\n * @param message - The message\n */\n public abstract debug(message: string): void;\n\n /**\n * Logs an error message.\n * @param message - The message\n */\n public abstract error(message: string): void;\n\n /**\n * Logs a fatal message.\n * @param message - The message\n */\n public abstract fatal(message: string): void;\n\n /**\n * Logs an informational message.\n * @param message - The message\n */\n public abstract info(message: string): void;\n\n /**\n * Logs a trace message.\n * @param message - The message\n */\n public abstract trace(message: string): void;\n\n /**\n * Logs a warning message.\n * @param message - The message\n */\n public abstract warn(message: string): void;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ export { ConsoleLoggingService } from "./ConsoleLoggingService";
2
+ export type { Logger } from "./Logger";
3
+ export { LoggingService } from "./LoggingService";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { ConsoleLoggingService } from "./ConsoleLoggingService";
2
+ export { LoggingService } from "./LoggingService";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["export { ConsoleLoggingService } from \"./ConsoleLoggingService\";\nexport type { Logger } from \"./Logger\";\nexport { LoggingService } from \"./LoggingService\";\n"]}
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@nuov.io/logging",
3
+ "version": "1.1.62",
4
+ "description": "The @nuov.io logging library.",
5
+ "author": "Timothy Neill",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "@nuov.io",
9
+ "logging"
10
+ ],
11
+ "homepage": "https://bitbucket.org/nuov-io/io.nuov.typescript",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://bitbucket.org/nuov-io/io.nuov.typescript.git"
15
+ },
16
+ "bugs": {
17
+ "email": "bugs@nuov.io"
18
+ },
19
+ "type": "module",
20
+ "sideEffects": false,
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "types": "./dist/index.d.ts",
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "default": "./dist/index.js"
29
+ }
30
+ },
31
+ "dependencies": {
32
+ "@nuov.io/sentence": "1.1.62"
33
+ },
34
+ "devDependencies": {
35
+ "@nuov.io/slugger": "1.1.62"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "scripts": {
41
+ "build": "tsc -p tsconfig.build.json && cp ../../LICENSE.md dist/",
42
+ "dev": "tsc -p tsconfig.build.json --watch",
43
+ "typecheck": "tsc --noEmit"
44
+ }
45
+ }