windmill-cli 1.423.0 → 1.423.2
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/esm/deps/jsr.io/@std/io/0.225.0/read_all.js +1 -1
- package/esm/deps/jsr.io/@std/log/0.224.10/file_handler.js +318 -0
- package/esm/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/logger.js +78 -0
- package/esm/deps.js +1 -1
- package/esm/gen/core/OpenAPI.js +1 -1
- package/esm/gen/services.gen.js +1 -1
- package/esm/main.js +1 -1
- package/package.json +1 -1
- package/types/deps/jsr.io/@std/bytes/{1.0.3 → 1.0.4}/concat.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/log/0.224.10/_config.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/log/0.224.10/_file_handler_symbols.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/log/0.224.10/_state.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/log/0.224.10/base_handler.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/log/0.224.10/console_handler.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/log/0.224.10/critical.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/log/0.224.10/debug.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/log/0.224.10/error.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/log/0.224.10/file_handler.d.ts +251 -0
- package/types/deps/jsr.io/@std/log/0.224.10/file_handler.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/log/0.224.10/formatters.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/log/0.224.10/get_logger.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/log/0.224.10/info.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/log/0.224.10/levels.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/logger.d.ts +83 -0
- package/types/deps/jsr.io/@std/log/0.224.10/logger.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/log/0.224.10/mod.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/log/0.224.10/rotating_file_handler.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/log/0.224.10/setup.d.ts.map +1 -0
- package/types/deps/jsr.io/@std/log/0.224.10/warn.d.ts.map +1 -0
- package/types/deps.d.ts +1 -1
- package/types/deps.d.ts.map +1 -1
- package/types/main.d.ts +1 -1
- package/esm/deps/jsr.io/@std/log/0.224.9/file_handler.js +0 -135
- package/types/deps/jsr.io/@std/log/0.224.9/_config.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/log/0.224.9/_file_handler_symbols.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/log/0.224.9/_state.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/log/0.224.9/base_handler.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/log/0.224.9/console_handler.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/log/0.224.9/critical.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/log/0.224.9/debug.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/log/0.224.9/error.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/log/0.224.9/file_handler.d.ts +0 -54
- package/types/deps/jsr.io/@std/log/0.224.9/file_handler.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/log/0.224.9/formatters.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/log/0.224.9/get_logger.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/log/0.224.9/info.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/log/0.224.9/levels.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/log/0.224.9/logger.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/log/0.224.9/mod.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/log/0.224.9/rotating_file_handler.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/log/0.224.9/setup.d.ts.map +0 -1
- package/types/deps/jsr.io/@std/log/0.224.9/warn.d.ts.map +0 -1
- /package/esm/deps/jsr.io/@std/bytes/{1.0.3 → 1.0.4}/concat.js +0 -0
- /package/esm/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/_config.js +0 -0
- /package/esm/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/_file_handler_symbols.js +0 -0
- /package/esm/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/_state.js +0 -0
- /package/esm/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/base_handler.js +0 -0
- /package/esm/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/console_handler.js +0 -0
- /package/esm/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/critical.js +0 -0
- /package/esm/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/debug.js +0 -0
- /package/esm/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/error.js +0 -0
- /package/esm/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/formatters.js +0 -0
- /package/esm/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/get_logger.js +0 -0
- /package/esm/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/info.js +0 -0
- /package/esm/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/levels.js +0 -0
- /package/esm/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/mod.js +0 -0
- /package/esm/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/rotating_file_handler.js +0 -0
- /package/esm/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/setup.js +0 -0
- /package/esm/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/warn.js +0 -0
- /package/types/deps/jsr.io/@std/bytes/{1.0.3 → 1.0.4}/concat.d.ts +0 -0
- /package/types/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/_config.d.ts +0 -0
- /package/types/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/_file_handler_symbols.d.ts +0 -0
- /package/types/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/_state.d.ts +0 -0
- /package/types/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/base_handler.d.ts +0 -0
- /package/types/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/console_handler.d.ts +0 -0
- /package/types/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/critical.d.ts +0 -0
- /package/types/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/debug.d.ts +0 -0
- /package/types/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/error.d.ts +0 -0
- /package/types/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/formatters.d.ts +0 -0
- /package/types/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/get_logger.d.ts +0 -0
- /package/types/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/info.d.ts +0 -0
- /package/types/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/levels.d.ts +0 -0
- /package/types/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/mod.d.ts +0 -0
- /package/types/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/rotating_file_handler.d.ts +0 -0
- /package/types/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/setup.d.ts +0 -0
- /package/types/deps/jsr.io/@std/log/{0.224.9 → 0.224.10}/warn.d.ts +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
2
2
|
// This module is browser compatible.
|
|
3
|
-
import { concat } from "../../bytes/1.0.
|
|
3
|
+
import { concat } from "../../bytes/1.0.4/concat.js";
|
|
4
4
|
import { DEFAULT_CHUNK_SIZE } from "./_constants.js";
|
|
5
5
|
/**
|
|
6
6
|
* Read {@linkcode Reader} `r` until EOF (`null`) and resolve to the content as
|
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
4
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
+
};
|
|
6
|
+
var _FileHandler_instances, _FileHandler_unloadCallback, _FileHandler_resetBuffer, _a, _b, _c, _d, _e, _f, _g;
|
|
7
|
+
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
8
|
+
import * as dntShim from "../../../../../_dnt.shims.js";
|
|
9
|
+
import { LogLevels } from "./levels.js";
|
|
10
|
+
import { BaseHandler } from "./base_handler.js";
|
|
11
|
+
import { writeAllSync } from "../../io/0.225.0/write_all.js";
|
|
12
|
+
import { bufSymbol, encoderSymbol, filenameSymbol, fileSymbol, modeSymbol, openOptionsSymbol, pointerSymbol, } from "./_file_handler_symbols.js";
|
|
13
|
+
/**
|
|
14
|
+
* A file-based log handler that writes log messages to a specified file with buffering and optional modes.
|
|
15
|
+
* The logs are buffered for optimized performance, writing to the file only
|
|
16
|
+
* when the buffer is full, on manual .flush() call, during logging of a critical message or when process ends.
|
|
17
|
+
* It is important to note that the file can grow indefinitely.
|
|
18
|
+
*
|
|
19
|
+
* This handler requires `--allow-write` permission on the log file.
|
|
20
|
+
*
|
|
21
|
+
* @example Usage
|
|
22
|
+
* ```ts no-assert ignore
|
|
23
|
+
* import { FileHandler } from "@std/log/file-handler";
|
|
24
|
+
*
|
|
25
|
+
* const handler = new FileHandler("INFO", { filename: "./logs.txt" });
|
|
26
|
+
* handler.setup();
|
|
27
|
+
* handler.log('Hello, world!'); // Buffers the message, or writes it to the file depending on buffer state
|
|
28
|
+
* handler.flush(); // Manually flushes the buffer
|
|
29
|
+
* handler.destroy(); // Closes the file and removes listeners
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export class FileHandler extends BaseHandler {
|
|
33
|
+
/**
|
|
34
|
+
* Constructs a new FileHandler instance.
|
|
35
|
+
*
|
|
36
|
+
* @param levelName The level name to log messages at.
|
|
37
|
+
* @param options Options for the handler.
|
|
38
|
+
*/
|
|
39
|
+
constructor(levelName, options) {
|
|
40
|
+
super(levelName, options);
|
|
41
|
+
_FileHandler_instances.add(this);
|
|
42
|
+
/** Opened file to append logs to.
|
|
43
|
+
* @example Usage
|
|
44
|
+
* ```ts no-assert ignore
|
|
45
|
+
* import { FileHandler } from "@std/log/file-handler";
|
|
46
|
+
*
|
|
47
|
+
* const handler = new FileHandler("INFO", { filename: "./logs.txt" });
|
|
48
|
+
* handler.setup();
|
|
49
|
+
* handler.log('Hello, world!'); // Buffers the message, or writes it to the file depending on buffer state
|
|
50
|
+
* handler.flush(); // Manually flushes the buffer
|
|
51
|
+
* handler.destroy(); // Closes the file and removes listeners
|
|
52
|
+
* ```
|
|
53
|
+
* **/
|
|
54
|
+
Object.defineProperty(this, _a, {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
configurable: true,
|
|
57
|
+
writable: true,
|
|
58
|
+
value: void 0
|
|
59
|
+
});
|
|
60
|
+
/** Buffer used to write to file.
|
|
61
|
+
* @example Usage
|
|
62
|
+
* ```ts no-assert ignore
|
|
63
|
+
* import { FileHandler } from "@std/log/file-handler";
|
|
64
|
+
*
|
|
65
|
+
* const handler = new FileHandler("INFO", { filename: "./logs.txt" });
|
|
66
|
+
* handler.setup();
|
|
67
|
+
* handler.log('Hello, world!'); // Buffers the message, or writes it to the file depending on buffer state
|
|
68
|
+
* handler.flush(); // Manually flushes the buffer
|
|
69
|
+
* handler.destroy(); // Closes the file and removes listeners
|
|
70
|
+
* ```
|
|
71
|
+
* **/
|
|
72
|
+
Object.defineProperty(this, _b, {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
configurable: true,
|
|
75
|
+
writable: true,
|
|
76
|
+
value: void 0
|
|
77
|
+
});
|
|
78
|
+
/** Current position for pointer.
|
|
79
|
+
* @example Usage
|
|
80
|
+
* ```ts no-assert ignore
|
|
81
|
+
* import { FileHandler } from "@std/log/file-handler";
|
|
82
|
+
*
|
|
83
|
+
* const handler = new FileHandler("INFO", { filename: "./logs.txt" });
|
|
84
|
+
* handler.setup();
|
|
85
|
+
* handler.log('Hello, world!'); // Buffers the message, or writes it to the file depending on buffer state
|
|
86
|
+
* handler.flush(); // Manually flushes the buffer
|
|
87
|
+
* handler.destroy(); // Closes the file and removes listeners
|
|
88
|
+
* ```
|
|
89
|
+
* **/
|
|
90
|
+
Object.defineProperty(this, _c, {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
configurable: true,
|
|
93
|
+
writable: true,
|
|
94
|
+
value: 0
|
|
95
|
+
});
|
|
96
|
+
/** Filename associated with the file being logged.
|
|
97
|
+
* @example Usage
|
|
98
|
+
* ```ts no-assert ignore
|
|
99
|
+
* import { FileHandler } from "@std/log/file-handler";
|
|
100
|
+
*
|
|
101
|
+
* const handler = new FileHandler("INFO", { filename: "./logs.txt" });
|
|
102
|
+
* handler.setup();
|
|
103
|
+
* handler.log('Hello, world!'); // Buffers the message, or writes it to the file depending on buffer state
|
|
104
|
+
* handler.flush(); // Manually flushes the buffer
|
|
105
|
+
* handler.destroy(); // Closes the file and removes listeners
|
|
106
|
+
* ```
|
|
107
|
+
* **/
|
|
108
|
+
Object.defineProperty(this, _d, {
|
|
109
|
+
enumerable: true,
|
|
110
|
+
configurable: true,
|
|
111
|
+
writable: true,
|
|
112
|
+
value: void 0
|
|
113
|
+
});
|
|
114
|
+
/** Current log mode.
|
|
115
|
+
* @example Usage
|
|
116
|
+
* ```ts no-assert ignore
|
|
117
|
+
* import { FileHandler } from "@std/log/file-handler";
|
|
118
|
+
*
|
|
119
|
+
* const handler = new FileHandler("INFO", { filename: "./logs.txt" });
|
|
120
|
+
* handler.setup();
|
|
121
|
+
* handler.log('Hello, world!'); // Buffers the message, or writes it to the file depending on buffer state
|
|
122
|
+
* handler.flush(); // Manually flushes the buffer
|
|
123
|
+
* handler.destroy(); // Closes the file and removes listeners
|
|
124
|
+
* ```
|
|
125
|
+
* **/
|
|
126
|
+
Object.defineProperty(this, _e, {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
configurable: true,
|
|
129
|
+
writable: true,
|
|
130
|
+
value: void 0
|
|
131
|
+
});
|
|
132
|
+
/** File open options.
|
|
133
|
+
* @example Usage
|
|
134
|
+
* ```ts no-assert ignore
|
|
135
|
+
* import { FileHandler } from "@std/log/file-handler";
|
|
136
|
+
*
|
|
137
|
+
* const handler = new FileHandler("INFO", { filename: "./logs.txt" });
|
|
138
|
+
* handler.setup();
|
|
139
|
+
* handler.log('Hello, world!'); // Buffers the message, or writes it to the file depending on buffer state
|
|
140
|
+
* handler.flush(); // Manually flushes the buffer
|
|
141
|
+
* handler.destroy(); // Closes the file and removes listeners
|
|
142
|
+
* ```
|
|
143
|
+
* **/
|
|
144
|
+
Object.defineProperty(this, _f, {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
configurable: true,
|
|
147
|
+
writable: true,
|
|
148
|
+
value: void 0
|
|
149
|
+
});
|
|
150
|
+
/** Text encoder.
|
|
151
|
+
* @example Usage
|
|
152
|
+
* ```ts no-assert ignore
|
|
153
|
+
* import { FileHandler } from "@std/log/file-handler";
|
|
154
|
+
*
|
|
155
|
+
* const handler = new FileHandler("INFO", { filename: "./logs.txt" });
|
|
156
|
+
* handler.setup();
|
|
157
|
+
* handler.log('Hello, world!'); // Buffers the message, or writes it to the file depending on buffer state
|
|
158
|
+
* handler.flush(); // Manually flushes the buffer
|
|
159
|
+
* handler.destroy(); // Closes the file and removes listeners
|
|
160
|
+
* ```
|
|
161
|
+
* **/
|
|
162
|
+
Object.defineProperty(this, _g, {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
configurable: true,
|
|
165
|
+
writable: true,
|
|
166
|
+
value: new TextEncoder()
|
|
167
|
+
});
|
|
168
|
+
_FileHandler_unloadCallback.set(this, (() => {
|
|
169
|
+
this.destroy();
|
|
170
|
+
}).bind(this));
|
|
171
|
+
this[filenameSymbol] = options.filename;
|
|
172
|
+
// default to append mode, write only
|
|
173
|
+
this[modeSymbol] = options.mode ?? "a";
|
|
174
|
+
this[openOptionsSymbol] = {
|
|
175
|
+
createNew: this[modeSymbol] === "x",
|
|
176
|
+
create: this[modeSymbol] !== "x",
|
|
177
|
+
append: this[modeSymbol] === "a",
|
|
178
|
+
truncate: this[modeSymbol] !== "a",
|
|
179
|
+
write: true,
|
|
180
|
+
};
|
|
181
|
+
this[bufSymbol] = new Uint8Array(options.bufferSize ?? 4096);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Sets up the file handler by opening the specified file and initializing resources.
|
|
185
|
+
*
|
|
186
|
+
* @example Usage
|
|
187
|
+
* ```ts no-assert ignore
|
|
188
|
+
* import { FileHandler } from "@std/log/file-handler";
|
|
189
|
+
*
|
|
190
|
+
* const handler = new FileHandler("INFO", { filename: "./logs.txt" });
|
|
191
|
+
* handler.setup(); // Opens the file and prepares the handler for logging.
|
|
192
|
+
* handler.destroy();
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
setup() {
|
|
196
|
+
this[fileSymbol] = dntShim.Deno.openSync(this[filenameSymbol], this[openOptionsSymbol]);
|
|
197
|
+
__classPrivateFieldGet(this, _FileHandler_instances, "m", _FileHandler_resetBuffer).call(this);
|
|
198
|
+
addEventListener("unload", __classPrivateFieldGet(this, _FileHandler_unloadCallback, "f"));
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Handles a log record and flushes the buffer if the log level is higher than error.
|
|
202
|
+
*
|
|
203
|
+
* @param logRecord Log record to handle.
|
|
204
|
+
*
|
|
205
|
+
* @example Usage
|
|
206
|
+
* ```ts ignore
|
|
207
|
+
* import { FileHandler } from "@std/log/file-handler";
|
|
208
|
+
* import { assertInstanceOf } from "@std/assert/instance-of";
|
|
209
|
+
* import { LogLevels } from "./levels.ts";
|
|
210
|
+
* import { LogRecord } from "./logger.ts";
|
|
211
|
+
*
|
|
212
|
+
* const handler = new FileHandler("INFO", { filename: "./logs.txt" });
|
|
213
|
+
* handler.setup();
|
|
214
|
+
*
|
|
215
|
+
* // Flushes the buffer immediately and logs "CRITICAL This log is very critical indeed." into the file.
|
|
216
|
+
* handler.handle(
|
|
217
|
+
* new LogRecord({
|
|
218
|
+
* msg: "This log is very critical indeed.",
|
|
219
|
+
* args: [],
|
|
220
|
+
* level: LogLevels.CRITICAL,
|
|
221
|
+
* loggerName: "INFO",
|
|
222
|
+
* }),
|
|
223
|
+
* );
|
|
224
|
+
* handler.destroy();
|
|
225
|
+
*
|
|
226
|
+
* assertInstanceOf(handler, FileHandler);
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
handle(logRecord) {
|
|
230
|
+
super.handle(logRecord);
|
|
231
|
+
// Immediately flush if log level is higher than ERROR
|
|
232
|
+
if (logRecord.level > LogLevels.ERROR) {
|
|
233
|
+
this.flush();
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Logs a message by adding it to the buffer, with flushing as needed.
|
|
238
|
+
*
|
|
239
|
+
* @param msg The message to log.
|
|
240
|
+
*
|
|
241
|
+
* @example Usage
|
|
242
|
+
* ```ts ignore
|
|
243
|
+
* import { FileHandler } from "@std/log/file-handler";
|
|
244
|
+
* import { assertInstanceOf } from "@std/assert/instance-of";
|
|
245
|
+
*
|
|
246
|
+
* const handler = new FileHandler("INFO", { filename: "./logs.txt" });
|
|
247
|
+
* handler.setup();
|
|
248
|
+
* handler.log('Hello, world!');
|
|
249
|
+
* handler.flush();
|
|
250
|
+
* handler.destroy();
|
|
251
|
+
*
|
|
252
|
+
* assertInstanceOf(handler, FileHandler);
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
255
|
+
log(msg) {
|
|
256
|
+
const bytes = this[encoderSymbol].encode(msg + "\n");
|
|
257
|
+
if (bytes.byteLength > this[bufSymbol].byteLength - this[pointerSymbol]) {
|
|
258
|
+
this.flush();
|
|
259
|
+
}
|
|
260
|
+
if (bytes.byteLength > this[bufSymbol].byteLength) {
|
|
261
|
+
writeAllSync(this[fileSymbol], bytes);
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
this[bufSymbol].set(bytes, this[pointerSymbol]);
|
|
265
|
+
this[pointerSymbol] += bytes.byteLength;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Immediately writes the contents of the buffer to the previously opened file.
|
|
270
|
+
*
|
|
271
|
+
* @example Usage
|
|
272
|
+
* ```ts ignore
|
|
273
|
+
* import { FileHandler } from "@std/log/file-handler";
|
|
274
|
+
* import { assertInstanceOf } from "@std/assert/instance-of";
|
|
275
|
+
*
|
|
276
|
+
* const handler = new FileHandler("INFO", { filename: "./logs.txt" });
|
|
277
|
+
* handler.setup();
|
|
278
|
+
* handler.log('Hello, world!');
|
|
279
|
+
* handler.flush(); // Writes buffered log messages to the file immediately.
|
|
280
|
+
* handler.destroy();
|
|
281
|
+
*
|
|
282
|
+
* assertInstanceOf(handler, FileHandler);
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
285
|
+
flush() {
|
|
286
|
+
if (this[pointerSymbol] > 0 && this[fileSymbol]) {
|
|
287
|
+
let written = 0;
|
|
288
|
+
while (written < this[pointerSymbol]) {
|
|
289
|
+
written += this[fileSymbol].writeSync(this[bufSymbol].subarray(written, this[pointerSymbol]));
|
|
290
|
+
}
|
|
291
|
+
__classPrivateFieldGet(this, _FileHandler_instances, "m", _FileHandler_resetBuffer).call(this);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Destroys the handler, performing any cleanup that is required and closes the file handler.
|
|
296
|
+
*
|
|
297
|
+
* @example Usage
|
|
298
|
+
* ```ts ignore
|
|
299
|
+
* import { FileHandler } from "@std/log/file-handler";
|
|
300
|
+
* import { assertInstanceOf } from "@std/assert/instance-of";
|
|
301
|
+
*
|
|
302
|
+
* const handler = new FileHandler("INFO", { filename: "./logs.txt" });
|
|
303
|
+
* handler.setup();
|
|
304
|
+
* handler.destroy();
|
|
305
|
+
*
|
|
306
|
+
* assertInstanceOf(handler, FileHandler);
|
|
307
|
+
* ```
|
|
308
|
+
*/
|
|
309
|
+
destroy() {
|
|
310
|
+
this.flush();
|
|
311
|
+
this[fileSymbol]?.close();
|
|
312
|
+
this[fileSymbol] = undefined;
|
|
313
|
+
removeEventListener("unload", __classPrivateFieldGet(this, _FileHandler_unloadCallback, "f"));
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
_FileHandler_unloadCallback = new WeakMap(), _FileHandler_instances = new WeakSet(), _a = fileSymbol, _b = bufSymbol, _c = pointerSymbol, _d = filenameSymbol, _e = modeSymbol, _f = openOptionsSymbol, _g = encoderSymbol, _FileHandler_resetBuffer = function _FileHandler_resetBuffer() {
|
|
317
|
+
this[pointerSymbol] = 0;
|
|
318
|
+
};
|
|
@@ -13,14 +13,92 @@ var _LogRecord_args, _LogRecord_datetime, _Logger_instances, _Logger_level, _Log
|
|
|
13
13
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
14
14
|
// This module is browser compatible.
|
|
15
15
|
import { getLevelByName, getLevelName, LogLevels } from "./levels.js";
|
|
16
|
+
/**
|
|
17
|
+
* Configuration options for a logger instance.
|
|
18
|
+
*
|
|
19
|
+
* @example Usage
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* import { ConsoleHandler, getLogger, setup, type LogConfig} from "@std/log";
|
|
23
|
+
* import { assert } from "@std/assert";
|
|
24
|
+
*
|
|
25
|
+
* const handler = new ConsoleHandler("INFO");
|
|
26
|
+
* const logConfig: LogConfig = {
|
|
27
|
+
* handlers: {
|
|
28
|
+
* default: handler,
|
|
29
|
+
* },
|
|
30
|
+
* loggers: {
|
|
31
|
+
* default: {
|
|
32
|
+
* level: "INFO",
|
|
33
|
+
* handlers: ["default"],
|
|
34
|
+
* },
|
|
35
|
+
* },
|
|
36
|
+
* }
|
|
37
|
+
* setup(logConfig);
|
|
38
|
+
* const logger = getLogger();
|
|
39
|
+
*
|
|
40
|
+
* assert(logger.handlers.at(0) instanceof ConsoleHandler);
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
16
43
|
export class LoggerConfig {
|
|
17
44
|
constructor() {
|
|
45
|
+
/** The minimum log level for the logger.
|
|
46
|
+
*
|
|
47
|
+
* @example Usage
|
|
48
|
+
*
|
|
49
|
+
* ```ts
|
|
50
|
+
* import { ConsoleHandler, getLogger, setup, type LogConfig} from "@std/log";
|
|
51
|
+
* import { assert } from "@std/assert";
|
|
52
|
+
*
|
|
53
|
+
* const handler = new ConsoleHandler("INFO");
|
|
54
|
+
* const logConfig: LogConfig = {
|
|
55
|
+
* handlers: {
|
|
56
|
+
* default: handler,
|
|
57
|
+
* },
|
|
58
|
+
* loggers: {
|
|
59
|
+
* default: {
|
|
60
|
+
* level: "INFO",
|
|
61
|
+
* handlers: ["default"],
|
|
62
|
+
* },
|
|
63
|
+
* },
|
|
64
|
+
* }
|
|
65
|
+
* setup(logConfig);
|
|
66
|
+
* const logger = getLogger();
|
|
67
|
+
*
|
|
68
|
+
* assert(logger.handlers.at(0) instanceof ConsoleHandler);
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
18
71
|
Object.defineProperty(this, "level", {
|
|
19
72
|
enumerable: true,
|
|
20
73
|
configurable: true,
|
|
21
74
|
writable: true,
|
|
22
75
|
value: void 0
|
|
23
76
|
});
|
|
77
|
+
/** A list of handler names attached to this logger.
|
|
78
|
+
*
|
|
79
|
+
* @example Usage
|
|
80
|
+
*
|
|
81
|
+
* ```ts
|
|
82
|
+
* import { ConsoleHandler, getLogger, setup, type LogConfig} from "@std/log";
|
|
83
|
+
* import { assert } from "@std/assert";
|
|
84
|
+
*
|
|
85
|
+
* const handler = new ConsoleHandler("INFO");
|
|
86
|
+
* const logConfig: LogConfig = {
|
|
87
|
+
* handlers: {
|
|
88
|
+
* default: handler,
|
|
89
|
+
* },
|
|
90
|
+
* loggers: {
|
|
91
|
+
* default: {
|
|
92
|
+
* level: "INFO",
|
|
93
|
+
* handlers: ["default"],
|
|
94
|
+
* },
|
|
95
|
+
* },
|
|
96
|
+
* }
|
|
97
|
+
* setup(logConfig);
|
|
98
|
+
* const logger = getLogger();
|
|
99
|
+
*
|
|
100
|
+
* assert(logger.handlers.at(0) instanceof ConsoleHandler);
|
|
101
|
+
* ``` */
|
|
24
102
|
Object.defineProperty(this, "handlers", {
|
|
25
103
|
enumerable: true,
|
|
26
104
|
configurable: true,
|
package/esm/deps.js
CHANGED
|
@@ -19,7 +19,7 @@ export { encodeHex } from "./deps/jsr.io/@std/encoding/1.0.5/mod.js";
|
|
|
19
19
|
export { writeAllSync } from "./deps/jsr.io/@std/io/0.225.0/write_all.js";
|
|
20
20
|
export { copy } from "./deps/jsr.io/@std/io/0.225.0/copy.js";
|
|
21
21
|
export { readAll } from "./deps/jsr.io/@std/io/0.225.0/read_all.js";
|
|
22
|
-
export * as log from "./deps/jsr.io/@std/log/0.224.
|
|
22
|
+
export * as log from "./deps/jsr.io/@std/log/0.224.10/mod.js";
|
|
23
23
|
export { stringify as yamlStringify } from "./deps/jsr.io/@std/yaml/1.0.5/mod.js";
|
|
24
24
|
import { parse as yamlParse } from "./deps/jsr.io/@std/yaml/1.0.5/mod.js";
|
|
25
25
|
export async function yamlParseFile(path, options = {}) {
|
package/esm/gen/core/OpenAPI.js
CHANGED
package/esm/gen/services.gen.js
CHANGED
|
@@ -139,7 +139,7 @@ export const logout = () => {
|
|
|
139
139
|
export const getUser = (data) => {
|
|
140
140
|
return __request(OpenAPI, {
|
|
141
141
|
method: 'GET',
|
|
142
|
-
url: '/w/{workspace}/users/{username}',
|
|
142
|
+
url: '/w/{workspace}/users/get/{username}',
|
|
143
143
|
path: {
|
|
144
144
|
workspace: data.workspace,
|
|
145
145
|
username: data.username
|
package/esm/main.js
CHANGED
|
@@ -33,7 +33,7 @@ export { flow, app, script, workspace, resource, user, variable, hub, folder, sc
|
|
|
33
33
|
// console.error(JSON.stringify(event.error, null, 4));
|
|
34
34
|
// }
|
|
35
35
|
// });
|
|
36
|
-
export const VERSION = "1.423.
|
|
36
|
+
export const VERSION = "1.423.2";
|
|
37
37
|
const command = new Command()
|
|
38
38
|
.name("wmill")
|
|
39
39
|
.action(() => log.info(`Welcome to Windmill CLI ${VERSION}. Use -h for help.`))
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"concat.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/bytes/1.0.
|
|
1
|
+
{"version":3,"file":"concat.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/bytes/1.0.4/concat.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,GAAG,UAAU,CAaxD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_config.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/log/0.224.10/_config.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,aAAa,SAAS,CAAC;AAEpC,eAAO,MAAM,cAAc,EAAE,SAW5B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_file_handler_symbols.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/log/0.224.10/_file_handler_symbols.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,UAAU,eAAiB,CAAC;AACzC,eAAO,MAAM,SAAS,eAAgB,CAAC;AACvC,eAAO,MAAM,aAAa,eAAoB,CAAC;AAC/C,eAAO,MAAM,cAAc,eAAqB,CAAC;AACjD,eAAO,MAAM,UAAU,eAAiB,CAAC;AACzC,eAAO,MAAM,iBAAiB,eAAwB,CAAC;AACvD,eAAO,MAAM,aAAa,eAAoB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_state.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/log/0.224.10/_state.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,eAAO,MAAM,KAAK;;;;CAIjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base_handler.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/log/0.224.10/base_handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,QAAQ,EACd,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,SAAS,EAAE,SAAS,KAAK,MAAM,CAAC;AAIjE,2CAA2C;AAC3C,MAAM,WAAW,kBAAkB;IACjC,2CAA2C;IAC3C,SAAS,CAAC,EAAE,iBAAiB,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,8BAAsB,WAAW;;IAG/B;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,SAAS,EAAE,iBAAiB,CAAC;IAE7B;;;;;OAKG;gBAED,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE,kBAAkB;IAQ9B;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,IAAI,KAAK,IAAI,QAAQ,CAEpB;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,IAAI,KAAK,CAAC,KAAK,EAAE,QAAQ,EAGxB;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,IAAI,SAAS,IAAI,SAAS,CAEzB;IAED;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,IAAI,SAAS,CAAC,SAAS,EAAE,SAAS,EAGjC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,MAAM,CAAC,SAAS,EAAE,SAAS;IAO3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM;IAIpC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;OA0BG;IACH,KAAK;IAEL;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,OAAO;IAEP;;;;;;;;;;;;;;;;;;;OAmBG;IACH,CAAC,MAAM,CAAC,OAAO,CAAC;CAGjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console_handler.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/log/0.224.10/console_handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAa,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEzE,8CAA8C;AAC9C,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAuBD;;;;;;;;;;;GAWG;AACH,qBAAa,cAAe,SAAQ,WAAW;;IAG7C;;;;;OAKG;gBACS,SAAS,EAAE,SAAS,EAAE,OAAO,GAAE,qBAA0B;IAKrE;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACM,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM;IAU7C;;;;;;;;;;;;OAYG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM;CAIhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"critical.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/log/0.224.10/critical.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;AAC7E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EACxB,GAAG,EAAE,CAAC,SAAS,eAAe,GAAG,KAAK,GAAG,CAAC,EAC1C,GAAG,IAAI,EAAE,OAAO,EAAE,GACjB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/log/0.224.10/debug.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;AAC1E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAgB,KAAK,CAAC,CAAC,EACrB,GAAG,EAAE,CAAC,SAAS,eAAe,GAAG,KAAK,GAAG,CAAC,EAC1C,GAAG,IAAI,EAAE,OAAO,EAAE,GACjB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../../../../src/deps/jsr.io/@std/log/0.224.10/error.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,YAAY,CAAC;AAEpB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;AAC1E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,KAAK,CAAC,CAAC,EACrB,GAAG,EAAE,CAAC,SAAS,eAAe,GAAG,KAAK,GAAG,CAAC,EAC1C,GAAG,IAAI,EAAE,OAAO,EAAE,GACjB,CAAC,CAAC"}
|