@agilecustoms/envctl 0.36.1 → 0.36.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/dist/service/LogService.js +14 -3
- package/package.json +1 -1
|
@@ -18,11 +18,22 @@ export class LogService {
|
|
|
18
18
|
async getLogs(key, cwd) {
|
|
19
19
|
key = this.terraformAdapter.getKey(key, cwd);
|
|
20
20
|
const url = await this.envApi.getLogs(key);
|
|
21
|
-
const outDir = join(tmpdir(), 'envctl');
|
|
22
|
-
await mkdir(outDir, { recursive: true });
|
|
23
21
|
const urlPath = new URL(url).pathname;
|
|
24
22
|
const gzName = basename(urlPath);
|
|
25
|
-
const
|
|
23
|
+
const timestamp = Number(gzName.slice(0, -7)) * 1000;
|
|
24
|
+
const parts = new Intl.DateTimeFormat(undefined, {
|
|
25
|
+
year: 'numeric',
|
|
26
|
+
month: '2-digit',
|
|
27
|
+
day: '2-digit',
|
|
28
|
+
hour: '2-digit',
|
|
29
|
+
minute: '2-digit',
|
|
30
|
+
second: '2-digit',
|
|
31
|
+
hour12: false,
|
|
32
|
+
}).formatToParts(timestamp);
|
|
33
|
+
const get = (type) => parts.find(p => p.type === type)?.value ?? '';
|
|
34
|
+
const outName = `${get('year')}-${get('month')}-${get('day')}_${get('hour')}.${get('minute')}.${get('second')}.log`;
|
|
35
|
+
const outDir = join(tmpdir(), 'envctl');
|
|
36
|
+
await mkdir(outDir, { recursive: true });
|
|
26
37
|
const outPath = join(outDir, outName);
|
|
27
38
|
const res = await fetch(url);
|
|
28
39
|
if (!res.ok) {
|