vortez 5.0.3 → 6.0.0-dev.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.
- package/build/Template/Template.d.ts +0 -5
- package/build/Template/Template.js +5 -5
- package/build/Template/Template.js.map +1 -1
- package/build/Vortez.d.ts +2 -2
- package/build/Vortez.js +2 -2
- package/build/Vortez.js.map +1 -1
- package/build/beta/Mail.d.ts +2 -8
- package/build/beta/Mail.js +7 -2
- package/build/beta/Mail.js.map +1 -1
- package/build/server/Cookie.d.ts +9 -5
- package/build/server/Cookie.js +28 -24
- package/build/server/Cookie.js.map +1 -1
- package/build/server/LoggerManager.d.ts +1 -1
- package/build/server/LoggerManager.js +5 -5
- package/build/server/LoggerManager.js.map +1 -1
- package/build/server/Response.js +11 -11
- package/build/server/Response.js.map +1 -1
- package/build/server/Server.js +4 -4
- package/build/server/Server.js.map +1 -1
- package/build/server/ServerDebug.d.ts +1 -1
- package/build/server/ServerDebug.js +1 -1
- package/build/server/ServerDebug.js.map +1 -1
- package/build/server/config/Config.d.ts +7 -7
- package/build/server/config/Config.js +4 -3
- package/build/server/config/Config.js.map +1 -1
- package/build/server/config/Loader.js +5 -5
- package/build/server/config/Loader.js.map +1 -1
- package/build/server/router/HttpRule.d.ts +2 -2
- package/build/server/router/HttpRule.js +1 -1
- package/build/server/router/HttpRule.js.map +1 -1
- package/build/server/router/Router.d.ts +1 -1
- package/build/server/router/Router.js +5 -5
- package/build/server/router/Router.js.map +1 -1
- package/build/server/router/Rule.d.ts +1 -1
- package/build/server/router/WsRule.d.ts +2 -2
- package/build/server/router/WsRule.js +2 -2
- package/build/server/router/WsRule.js.map +1 -1
- package/build/server/router/algorithm/Algorithm.d.ts +1 -1
- package/build/server/router/algorithm/Algorithm.js +2 -2
- package/build/server/router/algorithm/Algorithm.js.map +1 -1
- package/build/server/router/algorithm/FIFO.d.ts +1 -1
- package/build/server/router/algorithm/FIFO.js +2 -2
- package/build/server/router/algorithm/FIFO.js.map +1 -1
- package/build/server/router/algorithm/Tree.d.ts +1 -1
- package/build/server/router/algorithm/Tree.js.map +1 -1
- package/build/server/router/middleware/Middleware.d.ts +5 -5
- package/build/server/router/middleware/WsMiddleware.d.ts +4 -4
- package/build/server/router/middleware/WsMiddleware.js +24 -23
- package/build/server/router/middleware/WsMiddleware.js.map +1 -1
- package/build/server/security/PathSecurity.js +5 -5
- package/build/server/security/PathSecurity.js.map +1 -1
- package/build/server/websocket/Codec.d.ts +128 -0
- package/build/server/websocket/Codec.js +192 -0
- package/build/server/websocket/Codec.js.map +1 -0
- package/build/server/websocket/Websocket.d.ts +38 -89
- package/build/server/websocket/Websocket.js +41 -249
- package/build/server/websocket/Websocket.js.map +1 -1
- package/build/server/websocket/WebsocketBase.d.ts +130 -0
- package/build/server/websocket/WebsocketBase.js +272 -0
- package/build/server/websocket/WebsocketBase.js.map +1 -0
- package/build/server/websocket/WebsocketCSInit.d.ts +57 -0
- package/build/server/websocket/WebsocketCSInit.js +95 -0
- package/build/server/websocket/WebsocketCSInit.js.map +1 -0
- package/build/server/websocket/WebsocketSSInit.d.ts +24 -0
- package/build/server/websocket/WebsocketSSInit.js +46 -0
- package/build/server/websocket/WebsocketSSInit.js.map +1 -0
- package/build/server/websocket/frame/Frame.d.ts +31 -0
- package/build/server/websocket/frame/Frame.js +45 -0
- package/build/server/websocket/frame/Frame.js.map +1 -0
- package/build/server/websocket/frame/Header.d.ts +31 -0
- package/build/server/websocket/frame/Header.js +31 -0
- package/build/server/websocket/frame/Header.js.map +1 -0
- package/build/server/websocket/frame/HeaderParser.d.ts +58 -0
- package/build/server/websocket/frame/HeaderParser.js +109 -0
- package/build/server/websocket/frame/HeaderParser.js.map +1 -0
- package/build/server/websocket/handshake/CSHandshaker.d.ts +46 -0
- package/build/server/websocket/handshake/CSHandshaker.js +122 -0
- package/build/server/websocket/handshake/CSHandshaker.js.map +1 -0
- package/build/server/websocket/handshake/SSHandshaker.d.ts +57 -0
- package/build/server/websocket/handshake/SSHandshaker.js +113 -0
- package/build/server/websocket/handshake/SSHandshaker.js.map +1 -0
- package/build/server/websocket/messageAssembler/Message.d.ts +21 -0
- package/build/server/websocket/messageAssembler/Message.js +20 -0
- package/build/server/websocket/messageAssembler/Message.js.map +1 -0
- package/build/server/websocket/messageAssembler/MessageAssembler.d.ts +25 -0
- package/build/server/websocket/messageAssembler/MessageAssembler.js +47 -0
- package/build/server/websocket/messageAssembler/MessageAssembler.js.map +1 -0
- package/changes.md +28 -0
- package/package.json +6 -1
- package/build/logger/Debug.d.ts +0 -174
- package/build/logger/Debug.js +0 -295
- package/build/logger/Debug.js.map +0 -1
- package/build/logger/Logger.d.ts +0 -38
- package/build/logger/Logger.js +0 -48
- package/build/logger/Logger.js.map +0 -1
- package/build/server/websocket/Chunk.d.ts +0 -36
- package/build/server/websocket/Chunk.js +0 -81
- package/build/server/websocket/Chunk.js.map +0 -1
- package/build/utilities/ConsoleUI.d.ts +0 -89
- package/build/utilities/ConsoleUI.js +0 -142
- package/build/utilities/ConsoleUI.js.map +0 -1
- package/build/utilities/DebugUI.d.ts +0 -66
- package/build/utilities/DebugUI.js +0 -98
- package/build/utilities/DebugUI.js.map +0 -1
- package/build/utilities/Encoding.d.ts +0 -22
- package/build/utilities/Encoding.js +0 -26
- package/build/utilities/Encoding.js.map +0 -1
- package/build/utilities/Env.d.ts +0 -81
- package/build/utilities/Env.js +0 -140
- package/build/utilities/Env.js.map +0 -1
- package/build/utilities/File.d.ts +0 -10
- package/build/utilities/File.js +0 -19
- package/build/utilities/File.js.map +0 -1
- package/build/utilities/Flatten.d.ts +0 -73
- package/build/utilities/Flatten.js +0 -76
- package/build/utilities/Flatten.js.map +0 -1
- package/build/utilities/Object.d.ts +0 -16
- package/build/utilities/Object.js +0 -48
- package/build/utilities/Object.js.map +0 -1
- package/build/utilities/Path.d.ts +0 -44
- package/build/utilities/Path.js +0 -69
- package/build/utilities/Path.js.map +0 -1
- package/build/utilities/Time.d.ts +0 -21
- package/build/utilities/Time.js +0 -25
- package/build/utilities/Time.js.map +0 -1
- package/build/utilities/Utilities.d.ts +0 -118
- package/build/utilities/Utilities.js +0 -112
- package/build/utilities/Utilities.js.map +0 -1
- package/build/utilities/schema/Introspection.d.ts +0 -24
- package/build/utilities/schema/Introspection.js +0 -87
- package/build/utilities/schema/Introspection.js.map +0 -1
- package/build/utilities/schema/JSONSchema.d.ts +0 -68
- package/build/utilities/schema/JSONSchema.js +0 -13
- package/build/utilities/schema/JSONSchema.js.map +0 -1
- package/build/utilities/schema/Schema.d.ts +0 -253
- package/build/utilities/schema/Schema.js +0 -241
- package/build/utilities/schema/Schema.js.map +0 -1
- package/build/utilities/schema/SchemaError.d.ts +0 -10
- package/build/utilities/schema/SchemaError.js +0 -13
- package/build/utilities/schema/SchemaError.js.map +0 -1
- package/build/utilities/schema/Validator.d.ts +0 -94
- package/build/utilities/schema/Validator.js +0 -246
- package/build/utilities/schema/Validator.js.map +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Events } from '@netfeez/common';
|
|
2
|
+
import Frame from '../frame/Frame.js';
|
|
3
|
+
import Message from './Message.js';
|
|
4
|
+
export declare class MessageAssembler extends Events<MessageAssembler.EventMap> {
|
|
5
|
+
private frames;
|
|
6
|
+
/**
|
|
7
|
+
* Pushes a frame into the assembler and attempts to assemble a complete message if the frame indicates the end of a message (FIN flag is set).
|
|
8
|
+
* Control frames are processed immediately, while data frames are accumulated until a complete message can be formed.
|
|
9
|
+
*
|
|
10
|
+
* @param frame - The frame to be pushed into the assembler for processing.
|
|
11
|
+
*/
|
|
12
|
+
push(frame: Frame): void;
|
|
13
|
+
/**
|
|
14
|
+
* Resets the assembler by clearing any stored frames.
|
|
15
|
+
* This is typically used to discard incomplete message data after an error is encountered, ensuring that subsequent messages are processed cleanly without interference from previous state.
|
|
16
|
+
*/
|
|
17
|
+
reset(): void;
|
|
18
|
+
}
|
|
19
|
+
export declare namespace MessageAssembler {
|
|
20
|
+
type EventMap = {
|
|
21
|
+
message: [message: Message];
|
|
22
|
+
error: [error: Error];
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export default MessageAssembler;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Events } from '@netfeez/common';
|
|
2
|
+
import Message from './Message.js';
|
|
3
|
+
export class MessageAssembler extends Events {
|
|
4
|
+
frames = [];
|
|
5
|
+
/**
|
|
6
|
+
* Pushes a frame into the assembler and attempts to assemble a complete message if the frame indicates the end of a message (FIN flag is set).
|
|
7
|
+
* Control frames are processed immediately, while data frames are accumulated until a complete message can be formed.
|
|
8
|
+
*
|
|
9
|
+
* @param frame - The frame to be pushed into the assembler for processing.
|
|
10
|
+
*/
|
|
11
|
+
push(frame) {
|
|
12
|
+
if (frame.isControl) {
|
|
13
|
+
if (!frame.header.fin)
|
|
14
|
+
return this.emit('error', new Error('Control frames must not be fragmented'));
|
|
15
|
+
const message = new Message([frame]);
|
|
16
|
+
return this.emit('message', message);
|
|
17
|
+
}
|
|
18
|
+
if (this.frames.length > 0 && !frame.isContinuation) {
|
|
19
|
+
this.reset();
|
|
20
|
+
this.emit('error', new Error('Protocol Error: Expected continuation frame (0x0).'));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (this.frames.length === 0 && frame.isContinuation) {
|
|
24
|
+
this.emit('error', new Error('Protocol Error: Unexpected continuation frame.'));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
this.frames.push(frame);
|
|
28
|
+
if (frame.header.fin) {
|
|
29
|
+
try {
|
|
30
|
+
const message = new Message(this.frames);
|
|
31
|
+
this.frames = [];
|
|
32
|
+
this.emit('message', message);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
this.reset();
|
|
36
|
+
this.emit('error', error instanceof Error ? error : new Error(String(error)));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Resets the assembler by clearing any stored frames.
|
|
42
|
+
* This is typically used to discard incomplete message data after an error is encountered, ensuring that subsequent messages are processed cleanly without interference from previous state.
|
|
43
|
+
*/
|
|
44
|
+
reset() { this.frames = []; }
|
|
45
|
+
}
|
|
46
|
+
export default MessageAssembler;
|
|
47
|
+
//# sourceMappingURL=MessageAssembler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageAssembler.js","sourceRoot":"","sources":["../../../../src/server/websocket/messageAssembler/MessageAssembler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAGzC,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,MAAM,OAAO,gBAAiB,SAAQ,MAAiC;IAC3D,MAAM,GAAY,EAAE,CAAC;IAC7B;;;;;OAKG;IACI,IAAI,CAAC,KAAY;QACpB,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;YAClB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG;gBAAE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC,CAAC;YACrG,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;YACrC,OAAO,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACzC,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;YAClD,IAAI,CAAC,KAAK,EAAE,CAAC;YACb,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC,CAAC;YACpF,OAAO;QACX,CAAC;QACD,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;YACnD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC,CAAC;YAChF,OAAO;QACX,CAAC;QACD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;YACnB,IAAI,CAAC;gBACD,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACzC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;gBACjB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;YAClC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAAI,CAAC,KAAK,EAAE,CAAC;gBACb,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAClF,CAAC;QACL,CAAC;IACL,CAAC;IACD;;;OAGG;IACI,KAAK,KAAW,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC;CAC7C;AAOD,eAAe,gBAAgB,CAAC"}
|
package/changes.md
CHANGED
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
# version (6.0.0)
|
|
2
|
+
## ⚠️ Breaking Changes
|
|
3
|
+
### (Server/Cookie)
|
|
4
|
+
- The `getSetters()` method has been removed from the `Cookie` class. Use the `setters` getter property instead.
|
|
5
|
+
- This change breaks compatibility with any code or tests that relied on `getSetters()`. Update your code to use `cookie.setters`.
|
|
6
|
+
|
|
7
|
+
## ➕ Added
|
|
8
|
+
- **(WebSocket/Orchestrator)**: Introduced `Websocket` orchestrator as the main entry point for WebSocket management.
|
|
9
|
+
- **(WebSocket/Handshake)**: Added `SSHandshaker` and `CSHandshaker` for RFC-6455 negotiation.
|
|
10
|
+
- **(WebSocket/Base)**: Implemented `WebsocketBase` as the core functional socket class.
|
|
11
|
+
- **(WebSocket/Init)**: Added `WebsocketSSInit` and `WebsocketCSInit` for specialized handshake flows.
|
|
12
|
+
- **(WebSocket/Protocol)**: Added binary `Frame` and `Header` parsing/decoding, and `Codec` for client/server data masking and payload management.
|
|
13
|
+
- **(WebSocket/Events)**: Added `Events` utility class for event-driven architecture.
|
|
14
|
+
- **(WebSocket/Assembler)**: Added `MessageAssembler` to handle fragmented WebSocket messages.
|
|
15
|
+
|
|
16
|
+
## ✏️ Changes
|
|
17
|
+
- **(Router/WsMiddleware)**: Updated `Router` and `WsMiddleware` to support the new WebSocket API routing and middleware with new pipeline.
|
|
18
|
+
- **(Server/Cookie & Response)**: Refactored for handshake compatibility.
|
|
19
|
+
|
|
20
|
+
## ❌ Removed
|
|
21
|
+
- **(WebSocket/Chunk.ts)**: Removed deprecated `Chunk.ts` in favor of the new `Frame` system.
|
|
22
|
+
|
|
1
23
|
# version (5.0.0)
|
|
2
24
|
## 📒 Notes
|
|
3
25
|
- **Breaking Change**: The server's debugging interface has been refactored. Users interacting with the old `DebugUI` will need to adapt to the new `ServerDebug` module.
|
|
@@ -12,6 +34,12 @@
|
|
|
12
34
|
- **(Server/DebugUI)**: Deleted the old `DebugUI.ts` which was tightly coupled with the `Server` class.
|
|
13
35
|
## 🐞 Fixes
|
|
14
36
|
## ✏️ Changes
|
|
37
|
+
|
|
38
|
+
# version (6.0.0)
|
|
39
|
+
## ⚠️ Breaking Changes
|
|
40
|
+
### (Server/Cookie)
|
|
41
|
+
- The `getSetters()` method has been removed from the `Cookie` class. Use the `setters` getter property instead.
|
|
42
|
+
- This change breaks compatibility with any code or tests that relied on `getSetters()`. Update your code to use `cookie.setters`.
|
|
15
43
|
- **(Vortez/DebugUI)**: The entire debugging system has been refactored for modularity. **This is a breaking change.**
|
|
16
44
|
- The `DebugUI` is no longer part of the `Server` class but is now composed of a generic `DebugUI` from utilities and a specific `ServerDebug` module.
|
|
17
45
|
- This decoupling allows other packages to leverage the `DebugUI` from `vortez`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vortez",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-dev.1",
|
|
4
4
|
"description": "a module for web server creation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/Vortez.js",
|
|
@@ -44,5 +44,10 @@
|
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^25.5.0",
|
|
46
46
|
"typescript": "^6.0.2"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@netfeez/common": "^1.0.3",
|
|
50
|
+
"@netfeez/common-node": "^1.0.1",
|
|
51
|
+
"@netfeez/vterm": "^1.0.0"
|
|
47
52
|
}
|
|
48
53
|
}
|
package/build/logger/Debug.d.ts
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author NetFeez <netfeez.dev@gmail.com>
|
|
3
|
-
* @description Add the debug system to the Vortez.
|
|
4
|
-
* @license Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
export declare class Debug {
|
|
7
|
-
private static readonly debugs;
|
|
8
|
-
static readonly defaultID: string;
|
|
9
|
-
static readonly default: Debug;
|
|
10
|
-
private static timestampFormat;
|
|
11
|
-
static showAll: boolean;
|
|
12
|
-
private id;
|
|
13
|
-
show: boolean;
|
|
14
|
-
private _save;
|
|
15
|
-
private filePath;
|
|
16
|
-
private rootPath;
|
|
17
|
-
private startDate;
|
|
18
|
-
private stream;
|
|
19
|
-
/**
|
|
20
|
-
* Retrieves an existing debug instance by its ID or creates a new one if it doesn't exist.
|
|
21
|
-
* @param id - The unique identifier for the debug instance. Defaults to `'_debug'`.
|
|
22
|
-
* @param options - Debug instance options.
|
|
23
|
-
* @returns The debug instance.
|
|
24
|
-
*/
|
|
25
|
-
static getInstance(id?: string, options?: Debug.options): Debug;
|
|
26
|
-
/**
|
|
27
|
-
* Constructs a new Debug instance. This constructor is private and should not be called directly. Use `Debug.getInstance()` instead.
|
|
28
|
-
* @param id - The unique identifier for the debug instance. Defaults to `'_default'`.
|
|
29
|
-
* @param options - Debug instance options.
|
|
30
|
-
*/
|
|
31
|
-
private constructor();
|
|
32
|
-
get save(): boolean;
|
|
33
|
-
set save(value: boolean);
|
|
34
|
-
/**
|
|
35
|
-
* Retrieves or creates the write stream to the debug file associated with this instance.
|
|
36
|
-
* @returns The stream to the debug file.
|
|
37
|
-
*/
|
|
38
|
-
private getStream;
|
|
39
|
-
/**
|
|
40
|
-
* Logs data with a '[LOG]' prefix to the console (if enabled) and/or the debug file (if enabled).
|
|
41
|
-
* @param data - The data to be logged. Can be multiple arguments of any type.
|
|
42
|
-
*/
|
|
43
|
-
log(...data: any[]): void;
|
|
44
|
-
/**
|
|
45
|
-
* Logs data with an '[INF]' prefix (for informational messages) to the console (if enabled) and/or the debug file (if enabled).
|
|
46
|
-
* @param data - The data to be logged. Can be multiple arguments of any type.
|
|
47
|
-
*/
|
|
48
|
-
info(...data: any[]): void;
|
|
49
|
-
/**
|
|
50
|
-
* Logs data with a '[WRN]' prefix (for warnings) to the console (if enabled) and/or the debug file (if enabled).
|
|
51
|
-
* @param data - The data to be logged. Can be multiple arguments of any type.
|
|
52
|
-
*/
|
|
53
|
-
warn(...data: any[]): void;
|
|
54
|
-
/**
|
|
55
|
-
* Logs data with an '[ERR]' prefix (for errors) to the console (if enabled) and/or the debug file (if enabled).
|
|
56
|
-
* @param data - The data to be logged. Can be multiple arguments of any type.
|
|
57
|
-
*/
|
|
58
|
-
error(...data: any[]): void;
|
|
59
|
-
/**
|
|
60
|
-
* Logs data with a custom prefix to the console (if enabled) and/or the debug file (if enabled).
|
|
61
|
-
* @param data - Data to log
|
|
62
|
-
* @param options - Log options
|
|
63
|
-
*/
|
|
64
|
-
customLog(data: any[], options: Debug.LogOptions): void;
|
|
65
|
-
/**
|
|
66
|
-
* Displays the log entry on the console.
|
|
67
|
-
* @param timestamp - The timestamp of the log entry.
|
|
68
|
-
* @param prefix - The prefix for the log entry.
|
|
69
|
-
* @param data - The data to be displayed.
|
|
70
|
-
*/
|
|
71
|
-
private showLog;
|
|
72
|
-
private formatMultiline;
|
|
73
|
-
/**
|
|
74
|
-
* Saves the log entry to the debug file.
|
|
75
|
-
* @param timestamp - The timestamp of the log entry.
|
|
76
|
-
* @param prefix - The prefix for the log entry.
|
|
77
|
-
* @param data - The data to be saved.
|
|
78
|
-
*/
|
|
79
|
-
private saveLog;
|
|
80
|
-
/**
|
|
81
|
-
* Logs data with a '[LOG]' prefix using the default debug instance.
|
|
82
|
-
* @param data - The data to be logged. Can be multiple arguments of any type.
|
|
83
|
-
*/
|
|
84
|
-
static log(...data: any[]): void;
|
|
85
|
-
/**
|
|
86
|
-
* Logs data with an '[INF]' prefix using the default debug instance.
|
|
87
|
-
* @param data - The data to be logged. Can be multiple arguments of any type.
|
|
88
|
-
*/
|
|
89
|
-
static info(...data: any[]): void;
|
|
90
|
-
/**
|
|
91
|
-
* Logs data with a '[WRN]' prefix using the default debug instance.
|
|
92
|
-
* @param data - Data to log.
|
|
93
|
-
*/
|
|
94
|
-
static warn(...data: any): void;
|
|
95
|
-
/**
|
|
96
|
-
* Logs data with an '[ERR]' prefix using the default debug instance.
|
|
97
|
-
* @param data - Data to log.
|
|
98
|
-
*/
|
|
99
|
-
static error(...data: any): void;
|
|
100
|
-
/**
|
|
101
|
-
* Clean a path.
|
|
102
|
-
* @param path - Path to clean.
|
|
103
|
-
* @returns Cleaned path.
|
|
104
|
-
*/
|
|
105
|
-
private static cleanPath;
|
|
106
|
-
/**
|
|
107
|
-
* Get the path to the debug file.
|
|
108
|
-
* @param id - Debug instance ID.
|
|
109
|
-
* @param folderPath - Path to the debug folder.
|
|
110
|
-
* @param date - Date of the debug instance.
|
|
111
|
-
* @returns The path to the debug file.
|
|
112
|
-
*/
|
|
113
|
-
private static getFilePath;
|
|
114
|
-
/**
|
|
115
|
-
* Generate a stream to the debug file.
|
|
116
|
-
* @param id - Debug instance ID.
|
|
117
|
-
* @param filePath - Path to the debug file.
|
|
118
|
-
* @param date - Date of the debug instance.
|
|
119
|
-
* @returns The stream to the debug file.
|
|
120
|
-
*/
|
|
121
|
-
private static generateStream;
|
|
122
|
-
/**
|
|
123
|
-
* Generate a datetime timestamp.
|
|
124
|
-
* @param format - Timestamp format.
|
|
125
|
-
* @returns Formatted datetime timestamp.
|
|
126
|
-
* @example `[DD-MM-YYYY] [hh:mm:ss:ms]`
|
|
127
|
-
*
|
|
128
|
-
* | variable | value |
|
|
129
|
-
* | -------- | ------ |
|
|
130
|
-
* | DD | day |
|
|
131
|
-
* | MM | month |
|
|
132
|
-
* | YYYY | year |
|
|
133
|
-
* | hh | hour |
|
|
134
|
-
* | mm | minute |
|
|
135
|
-
* | ss | second |
|
|
136
|
-
*/
|
|
137
|
-
private static getTimestamp;
|
|
138
|
-
/**
|
|
139
|
-
* Get the current date and time in formatted parts.
|
|
140
|
-
* @returns Object containing date parts and full formats.
|
|
141
|
-
*/
|
|
142
|
-
private static getDate;
|
|
143
|
-
}
|
|
144
|
-
export declare namespace Debug {
|
|
145
|
-
type debugMap = Map<string, Debug>;
|
|
146
|
-
interface LogOptions {
|
|
147
|
-
/** The prefix to use for the log entry. */
|
|
148
|
-
prefix?: string;
|
|
149
|
-
/** The separator to use between the prefix and the data. */
|
|
150
|
-
separator?: string;
|
|
151
|
-
/** Whether to show the log entry on the console. */
|
|
152
|
-
show?: boolean;
|
|
153
|
-
/** Whether to save the log entry to the debug file. */
|
|
154
|
-
save?: boolean;
|
|
155
|
-
}
|
|
156
|
-
interface options {
|
|
157
|
-
path?: string;
|
|
158
|
-
show?: boolean;
|
|
159
|
-
save?: boolean;
|
|
160
|
-
}
|
|
161
|
-
interface Date {
|
|
162
|
-
day: string;
|
|
163
|
-
month: string;
|
|
164
|
-
year: string;
|
|
165
|
-
hour: string;
|
|
166
|
-
minute: string;
|
|
167
|
-
second: string;
|
|
168
|
-
millisecond: string;
|
|
169
|
-
DateFormat: string;
|
|
170
|
-
TimeFormat: string;
|
|
171
|
-
now: globalThis.Date;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
export default Debug;
|
package/build/logger/Debug.js
DELETED
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author NetFeez <netfeez.dev@gmail.com>
|
|
3
|
-
* @description Add the debug system to the Vortez.
|
|
4
|
-
* @license Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import fs from 'fs';
|
|
7
|
-
import Utilities, { ConsoleUI } from '../utilities/Utilities.js';
|
|
8
|
-
export class Debug {
|
|
9
|
-
static debugs = new Map();
|
|
10
|
-
static defaultID = 'Debug';
|
|
11
|
-
static default = Debug.getInstance(this.defaultID);
|
|
12
|
-
static timestampFormat = '&C(255,255,255)[DD-MM-YYYY] [hh:mm:ss:ms]&R';
|
|
13
|
-
static showAll = false;
|
|
14
|
-
id;
|
|
15
|
-
show;
|
|
16
|
-
_save;
|
|
17
|
-
filePath;
|
|
18
|
-
rootPath;
|
|
19
|
-
startDate;
|
|
20
|
-
stream;
|
|
21
|
-
/**
|
|
22
|
-
* Retrieves an existing debug instance by its ID or creates a new one if it doesn't exist.
|
|
23
|
-
* @param id - The unique identifier for the debug instance. Defaults to `'_debug'`.
|
|
24
|
-
* @param options - Debug instance options.
|
|
25
|
-
* @returns The debug instance.
|
|
26
|
-
*/
|
|
27
|
-
static getInstance(id = this.defaultID, options = {}) {
|
|
28
|
-
if (id === this.defaultID)
|
|
29
|
-
return this.default || new Debug(id, options);
|
|
30
|
-
const debug = Debug.debugs.get(id);
|
|
31
|
-
if (!debug)
|
|
32
|
-
return new Debug(id, options);
|
|
33
|
-
if (Object.keys(options).length > 0) {
|
|
34
|
-
const called_in = new Error().stack?.split('\n')[2].trim();
|
|
35
|
-
this.warn(`The options of the debug instance with ID &C6${id}&R were overwritten &C6${called_in}`);
|
|
36
|
-
debug.save = options.save ?? debug.save;
|
|
37
|
-
debug.show = options.show ?? debug.show;
|
|
38
|
-
if (options.path)
|
|
39
|
-
this.warn(`The path of the debug instance with ID &C6${id}&R cant be overwritten before the initialization, the option will be ignored &C6${called_in}`);
|
|
40
|
-
}
|
|
41
|
-
return debug;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Constructs a new Debug instance. This constructor is private and should not be called directly. Use `Debug.getInstance()` instead.
|
|
45
|
-
* @param id - The unique identifier for the debug instance. Defaults to `'_default'`.
|
|
46
|
-
* @param options - Debug instance options.
|
|
47
|
-
*/
|
|
48
|
-
constructor(id = '_default', options = {}) {
|
|
49
|
-
const { path = '.debug', show = true, save = true } = options;
|
|
50
|
-
const now = Debug.getDate();
|
|
51
|
-
const rootPath = Debug.cleanPath(path);
|
|
52
|
-
const filePath = Debug.getFilePath(id, rootPath, now);
|
|
53
|
-
this.id = id;
|
|
54
|
-
this.show = show;
|
|
55
|
-
this._save = save;
|
|
56
|
-
this.rootPath = rootPath;
|
|
57
|
-
this.filePath = filePath;
|
|
58
|
-
this.startDate = now;
|
|
59
|
-
this.stream = null;
|
|
60
|
-
Debug.debugs.set(id, this);
|
|
61
|
-
}
|
|
62
|
-
get save() { return this._save; }
|
|
63
|
-
set save(value) {
|
|
64
|
-
this._save = value;
|
|
65
|
-
if (value)
|
|
66
|
-
this.stream = this.getStream();
|
|
67
|
-
else if (this.stream) {
|
|
68
|
-
this.stream.destroy();
|
|
69
|
-
this.stream = null;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Retrieves or creates the write stream to the debug file associated with this instance.
|
|
74
|
-
* @returns The stream to the debug file.
|
|
75
|
-
*/
|
|
76
|
-
getStream() {
|
|
77
|
-
if (!this.stream) {
|
|
78
|
-
const id = this.id;
|
|
79
|
-
const date = this.startDate;
|
|
80
|
-
const stream = Debug.generateStream(this.filePath);
|
|
81
|
-
stream.write([
|
|
82
|
-
'/* +----------------------------+* /',
|
|
83
|
-
'/* | NetFeez-Labs/Debug by NetFeez |* /',
|
|
84
|
-
'/* | Use NetFeez-Labs ReadDebug |* /',
|
|
85
|
-
'/* +----------------------------+* /',
|
|
86
|
-
`/* the name of the DebugFile is the DateTime of initialize Debug with ID ${id} */`,
|
|
87
|
-
`/* the initialize stream DateTime is ${date.DateFormat} << ${date.TimeFormat} */`,
|
|
88
|
-
'', ''
|
|
89
|
-
].join('\n'));
|
|
90
|
-
this.stream = stream;
|
|
91
|
-
this.log(`&C2&PStream created to the debug file: &C6&S${this.filePath}`);
|
|
92
|
-
}
|
|
93
|
-
return this.stream;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Logs data with a '[LOG]' prefix to the console (if enabled) and/or the debug file (if enabled).
|
|
97
|
-
* @param data - The data to be logged. Can be multiple arguments of any type.
|
|
98
|
-
*/
|
|
99
|
-
log(...data) { this.customLog(data, { prefix: `&C2[LOG] [${this.id}]` }); }
|
|
100
|
-
/**
|
|
101
|
-
* Logs data with an '[INF]' prefix (for informational messages) to the console (if enabled) and/or the debug file (if enabled).
|
|
102
|
-
* @param data - The data to be logged. Can be multiple arguments of any type.
|
|
103
|
-
*/
|
|
104
|
-
info(...data) { this.customLog(data, { prefix: `&C6[INF] [${this.id}]` }); }
|
|
105
|
-
/**
|
|
106
|
-
* Logs data with a '[WRN]' prefix (for warnings) to the console (if enabled) and/or the debug file (if enabled).
|
|
107
|
-
* @param data - The data to be logged. Can be multiple arguments of any type.
|
|
108
|
-
*/
|
|
109
|
-
warn(...data) { this.customLog(data, { prefix: `&C3[WRN] [${this.id}]` }); }
|
|
110
|
-
/**
|
|
111
|
-
* Logs data with an '[ERR]' prefix (for errors) to the console (if enabled) and/or the debug file (if enabled).
|
|
112
|
-
* @param data - The data to be logged. Can be multiple arguments of any type.
|
|
113
|
-
*/
|
|
114
|
-
error(...data) { this.customLog(data, { prefix: `&C1[ERR] [${this.id}]` }); }
|
|
115
|
-
/**
|
|
116
|
-
* Logs data with a custom prefix to the console (if enabled) and/or the debug file (if enabled).
|
|
117
|
-
* @param data - Data to log
|
|
118
|
-
* @param options - Log options
|
|
119
|
-
*/
|
|
120
|
-
customLog(data, options) {
|
|
121
|
-
const { prefix = ` &C2[LOG] [${this.id}&C2]`, show = this.show, save = this.save } = options;
|
|
122
|
-
const timestamp = Debug.getTimestamp();
|
|
123
|
-
if (save)
|
|
124
|
-
this.saveLog(timestamp, prefix, ...data);
|
|
125
|
-
if (show || Debug.showAll)
|
|
126
|
-
this.showLog(timestamp, prefix, ...data);
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Displays the log entry on the console.
|
|
130
|
-
* @param timestamp - The timestamp of the log entry.
|
|
131
|
-
* @param prefix - The prefix for the log entry.
|
|
132
|
-
* @param data - The data to be displayed.
|
|
133
|
-
*/
|
|
134
|
-
showLog(timestamp, prefix, ...data) {
|
|
135
|
-
timestamp = ConsoleUI.formatText(timestamp);
|
|
136
|
-
prefix = ConsoleUI.formatText(prefix);
|
|
137
|
-
const toShow = data.map((datum) => {
|
|
138
|
-
if (typeof datum === 'string') {
|
|
139
|
-
if (!datum.includes('\n'))
|
|
140
|
-
return ConsoleUI.formatText(datum);
|
|
141
|
-
else
|
|
142
|
-
return this.formatMultiline(timestamp, prefix, datum);
|
|
143
|
-
}
|
|
144
|
-
else if (datum instanceof Error)
|
|
145
|
-
return this.formatMultiline(timestamp, prefix, datum.stack ?? datum.message);
|
|
146
|
-
else
|
|
147
|
-
return datum;
|
|
148
|
-
});
|
|
149
|
-
console.log(`${timestamp} ${prefix} ->`, ...toShow);
|
|
150
|
-
}
|
|
151
|
-
formatMultiline(timestamp, prefix, data) {
|
|
152
|
-
timestamp = ConsoleUI.cleanFormat(timestamp);
|
|
153
|
-
prefix = ConsoleUI.cleanFormat(prefix);
|
|
154
|
-
const lines = data.split('\n');
|
|
155
|
-
const first = lines.shift();
|
|
156
|
-
const result = lines.map((line) => `${timestamp} ${prefix} -> ${line}`);
|
|
157
|
-
return ConsoleUI.formatText([first, ...result].join('\n'));
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Saves the log entry to the debug file.
|
|
161
|
-
* @param timestamp - The timestamp of the log entry.
|
|
162
|
-
* @param prefix - The prefix for the log entry.
|
|
163
|
-
* @param data - The data to be saved.
|
|
164
|
-
*/
|
|
165
|
-
saveLog(timestamp, prefix, ...data) {
|
|
166
|
-
timestamp = ConsoleUI.cleanFormat(timestamp);
|
|
167
|
-
prefix = ConsoleUI.cleanFormat(prefix);
|
|
168
|
-
const stream = this.getStream();
|
|
169
|
-
const toSave = data.map((datum) => typeof datum === 'string' ?
|
|
170
|
-
ConsoleUI.cleanFormat(datum) : datum);
|
|
171
|
-
stream.write(`${timestamp} ${prefix} -> ${JSON.stringify(toSave)}\n`);
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Logs data with a '[LOG]' prefix using the default debug instance.
|
|
175
|
-
* @param data - The data to be logged. Can be multiple arguments of any type.
|
|
176
|
-
*/
|
|
177
|
-
static log(...data) {
|
|
178
|
-
const debug = this.getInstance();
|
|
179
|
-
debug.log(...data);
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Logs data with an '[INF]' prefix using the default debug instance.
|
|
183
|
-
* @param data - The data to be logged. Can be multiple arguments of any type.
|
|
184
|
-
*/
|
|
185
|
-
static info(...data) {
|
|
186
|
-
const debug = this.getInstance();
|
|
187
|
-
debug.info(...data);
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Logs data with a '[WRN]' prefix using the default debug instance.
|
|
191
|
-
* @param data - Data to log.
|
|
192
|
-
*/
|
|
193
|
-
static warn(...data) {
|
|
194
|
-
const debug = this.getInstance();
|
|
195
|
-
debug.warn(...data);
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Logs data with an '[ERR]' prefix using the default debug instance.
|
|
199
|
-
* @param data - Data to log.
|
|
200
|
-
*/
|
|
201
|
-
static error(...data) {
|
|
202
|
-
const debug = this.getInstance();
|
|
203
|
-
debug.error(...data);
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* Clean a path.
|
|
207
|
-
* @param path - Path to clean.
|
|
208
|
-
* @returns Cleaned path.
|
|
209
|
-
*/
|
|
210
|
-
static cleanPath(path) {
|
|
211
|
-
path = Utilities.Path.normalize(path);
|
|
212
|
-
path = path.startsWith('/') ? path.slice(1) : path;
|
|
213
|
-
path = path.endsWith('/') ? path.slice(0, -1) : path;
|
|
214
|
-
return path;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Get the path to the debug file.
|
|
218
|
-
* @param id - Debug instance ID.
|
|
219
|
-
* @param folderPath - Path to the debug folder.
|
|
220
|
-
* @param date - Date of the debug instance.
|
|
221
|
-
* @returns The path to the debug file.
|
|
222
|
-
*/
|
|
223
|
-
static getFilePath(id, folderPath, date) {
|
|
224
|
-
const file = `[${id}] - ${date.hour}.${date.minute}.${date.second}.${date.millisecond}.vlog`;
|
|
225
|
-
const folder = `${folderPath}/[${date.day}.${date.month}.${date.year}]`;
|
|
226
|
-
const path = `${folder}/${file}`;
|
|
227
|
-
return path;
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Generate a stream to the debug file.
|
|
231
|
-
* @param id - Debug instance ID.
|
|
232
|
-
* @param filePath - Path to the debug file.
|
|
233
|
-
* @param date - Date of the debug instance.
|
|
234
|
-
* @returns The stream to the debug file.
|
|
235
|
-
*/
|
|
236
|
-
static generateStream(filePath) {
|
|
237
|
-
const folder = filePath.slice(0, filePath.lastIndexOf('/'));
|
|
238
|
-
if (!fs.existsSync(folder))
|
|
239
|
-
fs.mkdirSync(folder, { recursive: true });
|
|
240
|
-
const stream = fs.createWriteStream(filePath, 'utf8');
|
|
241
|
-
return stream;
|
|
242
|
-
}
|
|
243
|
-
/**
|
|
244
|
-
* Generate a datetime timestamp.
|
|
245
|
-
* @param format - Timestamp format.
|
|
246
|
-
* @returns Formatted datetime timestamp.
|
|
247
|
-
* @example `[DD-MM-YYYY] [hh:mm:ss:ms]`
|
|
248
|
-
*
|
|
249
|
-
* | variable | value |
|
|
250
|
-
* | -------- | ------ |
|
|
251
|
-
* | DD | day |
|
|
252
|
-
* | MM | month |
|
|
253
|
-
* | YYYY | year |
|
|
254
|
-
* | hh | hour |
|
|
255
|
-
* | mm | minute |
|
|
256
|
-
* | ss | second |
|
|
257
|
-
*/
|
|
258
|
-
static getTimestamp(format = this.timestampFormat, date = this.getDate()) {
|
|
259
|
-
const now = Debug.getDate();
|
|
260
|
-
// const timestamp = `[${now.hour}:${now.minute}:${now.second}:${now.millisecond}]`;
|
|
261
|
-
const timestamp = format
|
|
262
|
-
.replace(/DD/g, now.day)
|
|
263
|
-
.replace(/MM/g, now.month)
|
|
264
|
-
.replace(/YYYY/g, now.year)
|
|
265
|
-
.replace(/hh/g, now.hour)
|
|
266
|
-
.replace(/mm/g, now.minute)
|
|
267
|
-
.replace(/ss/g, now.second)
|
|
268
|
-
.replace(/ms/g, now.millisecond);
|
|
269
|
-
return timestamp;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Get the current date and time in formatted parts.
|
|
273
|
-
* @returns Object containing date parts and full formats.
|
|
274
|
-
*/
|
|
275
|
-
static getDate() {
|
|
276
|
-
const now = new Date();
|
|
277
|
-
const day = now.getDate().toString().padStart(2, '0');
|
|
278
|
-
const month = (now.getMonth() + 1).toString().padStart(2, '0');
|
|
279
|
-
const year = now.getFullYear().toString().padStart(4, '0');
|
|
280
|
-
const hour = now.getHours().toString().padStart(2, '0');
|
|
281
|
-
const minute = now.getMinutes().toString().padStart(2, '0');
|
|
282
|
-
const second = now.getSeconds().toString().padStart(2, '0');
|
|
283
|
-
const millisecond = now.getMilliseconds().toString().padStart(3, '0');
|
|
284
|
-
const DateFormat = `${day}-${month}-${year}`;
|
|
285
|
-
const TimeFormat = `${hour}.${minute}.${second}.${millisecond}`;
|
|
286
|
-
const result = {
|
|
287
|
-
day, month, year,
|
|
288
|
-
hour, minute, second, millisecond,
|
|
289
|
-
DateFormat, TimeFormat, now
|
|
290
|
-
};
|
|
291
|
-
return result;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
export default Debug;
|
|
295
|
-
//# sourceMappingURL=Debug.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Debug.js","sourceRoot":"","sources":["../../src/logger/Debug.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAmB,MAAM,IAAI,CAAC;AACrC,OAAO,SAAS,EAAE,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,OAAO,KAAK;IACT,MAAM,CAAU,MAAM,GAAmB,IAAI,GAAG,EAAE,CAAC;IACjD,MAAM,CAAU,SAAS,GAAW,OAAO,CAAC;IAC5C,MAAM,CAAU,OAAO,GAAU,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAClE,MAAM,CAAC,eAAe,GAAG,6CAA6C,CAAA;IACvE,MAAM,CAAC,OAAO,GAAY,KAAK,CAAC;IAC/B,EAAE,CAAS;IACZ,IAAI,CAAU;IACb,KAAK,CAAU;IACf,QAAQ,CAAS;IACjB,QAAQ,CAAS;IACpB,SAAS,CAAa;IACnB,MAAM,CAAqB;IACnC;;;;;OAKG;IACI,MAAM,CAAC,WAAW,CAAC,KAAa,IAAI,CAAC,SAAS,EAAE,UAAyB,EAAE;QAC9E,IAAI,EAAE,KAAK,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC,OAAO,IAAI,IAAI,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAEzE,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,KAAK,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QAEpC,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClC,MAAM,SAAS,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AC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC1D,MAAM,MAAM,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC5D,MAAM,MAAM,GAAG,GAAG,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC5D,MAAM,WAAW,GAAG,GAAG,CAAC,eAAe,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAEtE,MAAM,UAAU,GAAG,GAAG,GAAG,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAC7C,MAAM,UAAU,GAAG,GAAG,IAAI,IAAI,MAAM,IAAI,MAAM,IAAI,WAAW,EAAE,CAAC;QAChE,MAAM,MAAM,GAAe;YAC1B,GAAG,EAAE,KAAK,EAAE,IAAI;YAChB,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW;YACjC,UAAU,EAAE,UAAU,EAAE,GAAG;SAC3B,CAAC;QACI,OAAO,MAAM,CAAC;IAClB,CAAC;;AAkCL,eAAe,KAAK,CAAC"}
|
package/build/logger/Logger.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author NetFeez <netfeez.dev@gmail.com>
|
|
3
|
-
* @description Adds a logger class to have organized logs.
|
|
4
|
-
* @license Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import _Debug from "./Debug.js";
|
|
7
|
-
export { Debug } from "./Debug.js";
|
|
8
|
-
export declare class Logger {
|
|
9
|
-
private static readonly LEVEL_MAP;
|
|
10
|
-
private prefix;
|
|
11
|
-
private format;
|
|
12
|
-
private debug;
|
|
13
|
-
show: boolean;
|
|
14
|
-
save: boolean;
|
|
15
|
-
constructor(options?: Logger.Options);
|
|
16
|
-
log(...data: any[]): void;
|
|
17
|
-
warn(...data: any[]): void;
|
|
18
|
-
info(...data: any[]): void;
|
|
19
|
-
error(...data: any[]): void;
|
|
20
|
-
private getLogOptions;
|
|
21
|
-
}
|
|
22
|
-
export declare namespace Logger {
|
|
23
|
-
export import Debug = _Debug;
|
|
24
|
-
type level = 'log' | 'warn' | 'info' | 'error';
|
|
25
|
-
type LevelMap = Record<level, string>;
|
|
26
|
-
interface NewDebugOptions {
|
|
27
|
-
id: string;
|
|
28
|
-
path?: string;
|
|
29
|
-
show?: boolean;
|
|
30
|
-
save?: boolean;
|
|
31
|
-
}
|
|
32
|
-
interface Options {
|
|
33
|
-
prefix?: string;
|
|
34
|
-
format?: string;
|
|
35
|
-
debug?: string | Logger.Debug | NewDebugOptions;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
export default Logger;
|