node-logy 0.1.1 → 0.1.3

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;AAEH,0DAA6B;AAC7B,yCAOoB;AACpB,sDAAyB;AAEzB;;GAEG;AACH,MAAM,YAAY,GAAG,CAAC,CAAC;AAEvB;;GAEG;AACH,IAAI,UAAU,GAA0B,IAAI,CAAC;AAE7C;;GAEG;AACH,IAAI,QAAQ,GAAG,QAAQ,CAAC;AAExB;;GAEG;AACH,IAAI,WAAW,GAAW,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAE1C;;GAEG;AACH,IAAI,oBAAoB,GAAa,EAAE,CAAC;AAExC;;GAEG;AACH,MAAM,QAAQ,GAAG,GAAG,CAAC;AAErB;;GAEG;AACH,MAAM,6BAA6B,GAAG,GAAG,CAAC;AAE1C;;GAEG;AACH,IAAI,YAAY,GAA0B,IAAI,CAAC;AAE/C;;GAEG;AACH,MAAM,eAAe,GAAG,IAAI,0BAAe,EAAE,CAAC;AAE9C;;GAEG;AACH,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEzC;;GAEG;AACH,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC7B,IAAI,YAAY,EAAE,CAAC;QACjB,YAAY,CAAC,YAAY,CAAC,CAAC;QAC3B,YAAY,GAAG,IAAI,CAAC;IACtB,CAAC;AACH,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,KAAK,GAAG,GAAG,EAAE;IACjB,IAAI,oBAAoB,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;QACrD,OAAO;IACT,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;QACjC,MAAM,CAAC,MAAM,CACX,oBAAoB,CA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AAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC/B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAEhC;;GAEG;AACH,KAAK,UAAU,IAAI;IACjB,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC1E,QAAQ,GAAG,mBAAI,CAAC,SAAS,CAAC,mBAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;IAElD,MAAM,iBAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAEvD,YAAY,EAAE,CAAC;IAEf,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAA0B,EAAE,EAAE;QACtD,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC;QAClD,WAAW,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;QAC3B,QAAQ,EAAE,CAAC;IACb,CAAC,CAAC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-logy",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "A lightweight Node.js logging utility that outputs logs to the console and writes them to rotating log files. Supports different log levels, timestamps, and customizable formatting for production-ready applications.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,5 +0,0 @@
1
- /**
2
- * This is a self contained script that is spawend using the main node logger class as a sidecar to offload the writing logs to a log file to a serpate process
3
- */
4
- export {};
5
- //# sourceMappingURL=node_process.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"node_process.d.ts","sourceRoot":"","sources":["../src/node_process.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -1,247 +0,0 @@
1
- "use strict";
2
- /**
3
- * This is a self contained script that is spawend using the main node logger class as a sidecar to offload the writing logs to a log file to a serpate process
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const fs = require("fs");
7
- const path = require("path");
8
- /**
9
- * Holds args passed to the CLI
10
- */
11
- const args = process.argv.slice(2);
12
- /**
13
- * Options for how the process should act
14
- */
15
- const options = {
16
- basePath: "",
17
- startedUtc: new Date().toUTCString(),
18
- outputResponse: false,
19
- };
20
- /**
21
- * Buffer for stdin data
22
- */
23
- let buffer = Buffer.alloc(0);
24
- /**
25
- * How long we wait and collect logs before flushing
26
- */
27
- const FLUSH_MS = 100;
28
- /**
29
- * Buffer size threshold to trigger immediate flush (1MB)
30
- */
31
- const BATCH_SIZE = 1024 * 1024;
32
- /**
33
- * Holds a new line as a buffer
34
- */
35
- const NEWLINE_BUFFER = Buffer.from("\n");
36
- /**
37
- * Holds the messages we add to the log file
38
- */
39
- let batch = Buffer.alloc(0);
40
- /**
41
- * The timer used to run flush batches
42
- */
43
- let timer = null;
44
- /**
45
- * The stream to write to the file
46
- */
47
- let writeStream = null;
48
- /**
49
- * Write the data to the file stream
50
- *
51
- */
52
- function flushBatch() {
53
- if (batch.length === 0)
54
- return;
55
- writeStream?.write(batch);
56
- batch = Buffer.alloc(0);
57
- stopTimer();
58
- }
59
- /** Stop the timer for flush */
60
- function stopTimer() {
61
- if (timer) {
62
- clearTimeout(timer);
63
- timer = null;
64
- }
65
- }
66
- /**
67
- * Starts the flush timer to be called when it's ready
68
- */
69
- function startTimer() {
70
- if (timer)
71
- return;
72
- timer = setTimeout(() => {
73
- flushBatch();
74
- timer = null;
75
- }, FLUSH_MS);
76
- }
77
- /**
78
- * Loops through args and looks for flags and extracts and sets there values
79
- */
80
- function setOptionValues() {
81
- for (const arg of args) {
82
- if (arg.startsWith("--basePath=")) {
83
- options.basePath = path.resolve(arg.split("=")[1] ?? "");
84
- }
85
- }
86
- }
87
- /**
88
- * Validate the arg values to make sure they are valid
89
- */
90
- function validateOptions() {
91
- if (!options.basePath || options.basePath == "") {
92
- console.error("Error: --basePath is required");
93
- console.error("Usage: --basePath=/some/path");
94
- process.exit(1);
95
- }
96
- }
97
- /**
98
- * Sync create the base folder path if it does not exist
99
- */
100
- function createBasePath() {
101
- try {
102
- if (!fs.existsSync(options.basePath)) {
103
- fs.mkdirSync(options.basePath, { recursive: true });
104
- }
105
- }
106
- catch (error) {
107
- console.error("Failed to make base dir");
108
- console.error(error);
109
- process.exit(1);
110
- }
111
- }
112
- /**
113
- * Gets todays log file path in format YYYY-MM-DD and returns a string for example `c:/dev/logs/2026-01.23.log`
114
- */
115
- function getTodaysLogFile() {
116
- const today = new Date().toISOString().split("T")[0];
117
- return path.join(options.basePath, `${today}.log`);
118
- }
119
- /**
120
- * Send response back to stdout
121
- */
122
- function sendResponse(response) {
123
- if (options.outputResponse) {
124
- const json = JSON.stringify(response);
125
- const header = `Content-Length: ${Buffer.byteLength(json, "utf8")}\r\n\r\n`;
126
- process.stdout.write(header + json);
127
- }
128
- }
129
- /**
130
- * Handle a request
131
- */
132
- function handleRequest(req) {
133
- try {
134
- if (!req || typeof req !== "object")
135
- throw new Error("Invalid request object");
136
- const { id, method, data } = req;
137
- if (typeof id !== "number")
138
- throw new Error("Invalid or missing id");
139
- if (typeof method !== "string")
140
- throw new Error("Invalid or missing method");
141
- switch (method) {
142
- case "log":
143
- const logText = String(data);
144
- batch = Buffer.concat([batch, Buffer.from(logText), NEWLINE_BUFFER]);
145
- if (batch.length >= BATCH_SIZE) {
146
- flushBatch();
147
- }
148
- else {
149
- startTimer();
150
- }
151
- sendResponse({
152
- id,
153
- method,
154
- success: true,
155
- error: null,
156
- message: "queued",
157
- });
158
- break;
159
- case "flush":
160
- flushBatch();
161
- stopTimer();
162
- process.stdin.removeAllListeners(); // stops process hanging
163
- process.stdin.destroy();
164
- writeStream?.end(); // stops process hanging
165
- writeStream?.destroy();
166
- sendResponse({
167
- id,
168
- method,
169
- success: true,
170
- error: null,
171
- message: "flushed and closed",
172
- });
173
- process.stdout.removeAllListeners(); // stops process hanging
174
- process.stdout.destroy();
175
- break;
176
- case "reload":
177
- flushBatch();
178
- writeStream?.end();
179
- writeStream = fs.createWriteStream(getTodaysLogFile(), { flags: "a" });
180
- sendResponse({
181
- id,
182
- method,
183
- success: true,
184
- error: null,
185
- message: "reloaded",
186
- });
187
- break;
188
- default:
189
- throw new Error("Unknown method: " + method);
190
- }
191
- }
192
- catch (err) {
193
- sendResponse({
194
- id: req?.id ?? -1,
195
- method: req?.method ?? "unknown",
196
- success: false,
197
- error: err instanceof Error ? err.message : String(err),
198
- message: null,
199
- });
200
- }
201
- }
202
- /**
203
- * Parses the buffer for complete messages
204
- */
205
- function parseBuffer() {
206
- while (true) {
207
- const headerEnd = buffer.indexOf("\r\n\r\n");
208
- if (headerEnd === -1)
209
- break;
210
- const header = buffer.subarray(0, headerEnd).toString();
211
- const match = header.match(/Content-Length:\s*(\d+)/i);
212
- if (!match) {
213
- buffer = buffer.subarray(headerEnd + 4);
214
- continue;
215
- }
216
- const contentLength = parseInt(match[1], 10);
217
- const bodyStart = headerEnd + 4;
218
- if (buffer.length < bodyStart + contentLength)
219
- break;
220
- const body = buffer
221
- .subarray(bodyStart, bodyStart + contentLength)
222
- .toString();
223
- buffer = Buffer.from(buffer.subarray(bodyStart + contentLength));
224
- try {
225
- const request = JSON.parse(body);
226
- handleRequest(request);
227
- }
228
- catch (e) {
229
- console.error("JSON Parse Error");
230
- }
231
- }
232
- }
233
- /**
234
- * Main entry point
235
- */
236
- async function main() {
237
- setOptionValues();
238
- validateOptions();
239
- createBasePath();
240
- writeStream = fs.createWriteStream(getTodaysLogFile(), { flags: "a" });
241
- process.stdin.on("data", (chunk) => {
242
- buffer = Buffer.concat([buffer, chunk]);
243
- parseBuffer();
244
- });
245
- }
246
- main();
247
- //# sourceMappingURL=node_process.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"node_process.js","sourceRoot":"","sources":["../src/node_process.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAGH,yBAA0B;AAC1B,6BAA8B;AAE9B;;GAEG;AACH,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEnC;;GAEG;AACH,MAAM,OAAO,GAA6B;IACxC,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;IACpC,cAAc,EAAE,KAAK;CACtB,CAAC;AAEF;;GAEG;AACH,IAAI,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAE7B;;GAEG;AACH,MAAM,QAAQ,GAAG,GAAG,CAAC;AAErB;;GAEG;AACH,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;AAE/B;;GAEG;AACH,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEzC;;GAEG;AACH,IAAI,KAAK,GAAW,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEpC;;GAEG;AACH,IAAI,KAAK,GAA0B,IAAI,CAAC;AAExC;;GAEG;AACH,IAAI,WAAW,GAA0B,IAAI,CAAC;AAE9C;;;GAGG;AACH,SAAS,UAAU;IACjB,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAE/B,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IAC1B,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAExB,SAAS,EAAE,CAAC;AACd,CAAC;AAED,+BAA+B;AAC/B,SAAS,SAAS;IA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AS,EAAE,SAAS,GAAG,aAAa,CAAC;aAC9C,QAAQ,EAAE,CAAC;QACd,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,GAAG,aAAa,CAAC,CAAC,CAAC;QAEjE,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACjC,aAAa,CAAC,OAAO,CAAC,CAAC;QACzB,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;QACpC,CAAC;IACH,CAAC;AACH,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,IAAI;IACjB,eAAe,EAAE,CAAC;IAClB,eAAe,EAAE,CAAC;IAClB,cAAc,EAAE,CAAC;IAEjB,WAAW,GAAG,EAAE,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;IAEvE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;QACzC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;QACxC,WAAW,EAAE,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC"}
package/dist/types.d.ts DELETED
@@ -1,88 +0,0 @@
1
- /**
2
- * List of methods / actions that the node_process can perform
3
- */
4
- export type RequestMethod = "log" | "reload" | "flush";
5
- /**
6
- * Represents the shape of data sent to the node_process
7
- */
8
- export type NodeProcessRequest = {
9
- id: number;
10
- method: RequestMethod;
11
- data: any;
12
- };
13
- /**
14
- * Response shape
15
- */
16
- export type NodeProcessResponse = {
17
- id: number;
18
- method: RequestMethod;
19
- success: boolean;
20
- error: any;
21
- message: any;
22
- };
23
- /**
24
- * Options for node_process mapped from CLI args
25
- */
26
- export type NodeProcessOptions = {
27
- /**
28
- * The base path that points to the directory we will write the log files to
29
- */
30
- basePath: string;
31
- /**
32
- * The time the process started as a string in UTC time
33
- */
34
- startedUtc: string;
35
- /**
36
- * Indicates if it should output the response messages
37
- */
38
- outputResponse: boolean;
39
- };
40
- /**
41
- * Indicates which level of log should be used
42
- */
43
- export type LogLevel = "WARN" | "INFO" | "ERROR";
44
- /**
45
- * List of options you can pass to change the logger behaviour
46
- */
47
- export type NodeLoggerOptions = {
48
- /**
49
- * Indicates if stdout console output produced by this logger should be saved to log files (defaults to `true`)
50
- */
51
- saveToLogFile: boolean;
52
- /**
53
- * The base path / path to the folder to save the log outputs to (defaults to `./logs`) then is converted to an absolute path internally
54
- */
55
- logFilesBasePath: string;
56
- /**
57
- * Indicates if it should add the time of when the log was made for a given log item (defaults to `true`)
58
- */
59
- showLogTime: boolean;
60
- /**
61
- * Indicates if it should use colored console outputs (defaults to `true`)
62
- */
63
- useAnsiColors: boolean;
64
- /**
65
- * Mapped type: Each LogLevel must correspond to a string color value
66
- *
67
- * (default)
68
- * ```js
69
- * colorMap: {
70
- INFO: "\x1b[32m", // Green
71
- WARN: "\x1b[33m", // Yellow
72
- ERROR: "\x1b[31m", // Red
73
- },
74
- * ```
75
- */
76
- colorMap: {
77
- [key in LogLevel]: string;
78
- };
79
- /**
80
- * Indicates if it should print messages to stdout for the logger (defaults to `true`)
81
- */
82
- showConsoleOutput: boolean;
83
- /**
84
- * Indicates if it should also show the stack trace of where the log came from (defaults to `false`)
85
- */
86
- showStackTraceOfLogCalls: boolean;
87
- };
88
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,EAAE,GAAG,CAAC;CACX,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC;IACX,OAAO,EAAE,GAAG,CAAC;CACd,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,cAAc,EAAC,OAAO,CAAA;CACvB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,aAAa,EAAE,OAAO,CAAC;IAEvB;;;;;;;;;;;OAWG;IACH,QAAQ,EAAE;SACP,GAAG,IAAI,QAAQ,GAAG,MAAM;KAC1B,CAAC;IAGF;;OAEG;IACH,iBAAiB,EAAE,OAAO,CAAA;IAE1B;;OAEG;IACH,wBAAwB,EAAE,OAAO,CAAA;CAClC,CAAC"}
package/dist/types.js DELETED
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=types.js.map
package/dist/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}