@teambit/logger 0.0.778 → 0.0.780

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.
@@ -17,7 +17,7 @@ export declare class LongProcessLogger {
17
17
  private startTime;
18
18
  constructor(logPublisher: Logger, extensionName: string, processDescription: string, totalItems?: number | undefined, currentItem?: number, startTime?: [number, number]);
19
19
  logProgress(itemName?: string): void;
20
- end(): void;
20
+ end(alternateDescriptionPrefix?: string): void;
21
21
  private start;
22
22
  private logAndConsole;
23
23
  }
@@ -37,9 +37,10 @@ class LongProcessLogger {
37
37
  this.logPublisher.debug(message);
38
38
  this.logPublisher.setStatusLine(`${this.extensionName}, ${message}`);
39
39
  }
40
- end() {
40
+ end(alternateDescriptionPrefix) {
41
+ const description = alternateDescriptionPrefix || this.processDescription;
41
42
  const duration = process.hrtime(this.startTime);
42
- const message = `${this.processDescription} (completed in ${(0, _prettyTime().default)(duration)})`;
43
+ const message = `${description} (completed in ${(0, _prettyTime().default)(duration)})`;
43
44
  this.logAndConsole(message);
44
45
  }
45
46
  start() {
@@ -1 +1 @@
1
- {"version":3,"names":["LongProcessLogger","constructor","logPublisher","extensionName","processDescription","totalItems","currentItem","startTime","process","hrtime","start","logProgress","itemName","message","debug","setStatusLine","end","duration","prettyTime","logAndConsole","totalItemsStr","info"],"sources":["long-process-logger.ts"],"sourcesContent":["import prettyTime from 'pretty-time';\nimport type { Logger } from './logger';\n\n/**\n * use it for a long running process. upon creation it logs the `processDescription`.\n * if the process involves iteration over a list of items, such as running tag on a list of\n * components, then pass the `totalItems` as the total components in the list.\n * later, during the iteration, call `logProgress(componentName)`.\n * once done, call `end()`.\n * the status-line will show all messages in the terminal.\n * see README for more data.\n */\nexport class LongProcessLogger {\n constructor(\n private logPublisher: Logger,\n private extensionName: string,\n private processDescription: string,\n private totalItems?: number,\n private currentItem = 0,\n private startTime = process.hrtime()\n ) {\n this.start();\n }\n\n logProgress(itemName = '') {\n this.currentItem += 1;\n const message = `${this.processDescription} (${this.currentItem}/${this.totalItems}). ${itemName}`;\n this.logPublisher.debug(message);\n this.logPublisher.setStatusLine(`${this.extensionName}, ${message}`);\n }\n\n end() {\n const duration = process.hrtime(this.startTime);\n const message = `${this.processDescription} (completed in ${prettyTime(duration)})`;\n this.logAndConsole(message);\n }\n\n private start() {\n const totalItemsStr = this.totalItems ? `(total: ${this.totalItems})` : '';\n const message = `${this.processDescription} ${totalItemsStr}`;\n this.logAndConsole(message);\n }\n\n private logAndConsole(message: string) {\n this.logPublisher.info(message);\n this.logPublisher.setStatusLine(`${this.extensionName}, ${message}`);\n }\n}\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,iBAAiB,CAAC;EAC7BC,WAAW,CACDC,YAAoB,EACpBC,aAAqB,EACrBC,kBAA0B,EAC1BC,UAAmB,EACnBC,WAAW,GAAG,CAAC,EACfC,SAAS,GAAGC,OAAO,CAACC,MAAM,EAAE,EACpC;IAAA,KANQP,YAAoB,GAApBA,YAAoB;IAAA,KACpBC,aAAqB,GAArBA,aAAqB;IAAA,KACrBC,kBAA0B,GAA1BA,kBAA0B;IAAA,KAC1BC,UAAmB,GAAnBA,UAAmB;IAAA,KACnBC,WAAW,GAAXA,WAAW;IAAA,KACXC,SAAS,GAATA,SAAS;IAEjB,IAAI,CAACG,KAAK,EAAE;EACd;EAEAC,WAAW,CAACC,QAAQ,GAAG,EAAE,EAAE;IACzB,IAAI,CAACN,WAAW,IAAI,CAAC;IACrB,MAAMO,OAAO,GAAI,GAAE,IAAI,CAACT,kBAAmB,KAAI,IAAI,CAACE,WAAY,IAAG,IAAI,CAACD,UAAW,MAAKO,QAAS,EAAC;IAClG,IAAI,CAACV,YAAY,CAACY,KAAK,CAACD,OAAO,CAAC;IAChC,IAAI,CAACX,YAAY,CAACa,aAAa,CAAE,GAAE,IAAI,CAACZ,aAAc,KAAIU,OAAQ,EAAC,CAAC;EACtE;EAEAG,GAAG,GAAG;IACJ,MAAMC,QAAQ,GAAGT,OAAO,CAACC,MAAM,CAAC,IAAI,CAACF,SAAS,CAAC;IAC/C,MAAMM,OAAO,GAAI,GAAE,IAAI,CAACT,kBAAmB,kBAAiB,IAAAc,qBAAU,EAACD,QAAQ,CAAE,GAAE;IACnF,IAAI,CAACE,aAAa,CAACN,OAAO,CAAC;EAC7B;EAEQH,KAAK,GAAG;IACd,MAAMU,aAAa,GAAG,IAAI,CAACf,UAAU,GAAI,WAAU,IAAI,CAACA,UAAW,GAAE,GAAG,EAAE;IAC1E,MAAMQ,OAAO,GAAI,GAAE,IAAI,CAACT,kBAAmB,IAAGgB,aAAc,EAAC;IAC7D,IAAI,CAACD,aAAa,CAACN,OAAO,CAAC;EAC7B;EAEQM,aAAa,CAACN,OAAe,EAAE;IACrC,IAAI,CAACX,YAAY,CAACmB,IAAI,CAACR,OAAO,CAAC;IAC/B,IAAI,CAACX,YAAY,CAACa,aAAa,CAAE,GAAE,IAAI,CAACZ,aAAc,KAAIU,OAAQ,EAAC,CAAC;EACtE;AACF;AAAC"}
1
+ {"version":3,"names":["LongProcessLogger","constructor","logPublisher","extensionName","processDescription","totalItems","currentItem","startTime","process","hrtime","start","logProgress","itemName","message","debug","setStatusLine","end","alternateDescriptionPrefix","description","duration","prettyTime","logAndConsole","totalItemsStr","info"],"sources":["long-process-logger.ts"],"sourcesContent":["import prettyTime from 'pretty-time';\nimport type { Logger } from './logger';\n\n/**\n * use it for a long running process. upon creation it logs the `processDescription`.\n * if the process involves iteration over a list of items, such as running tag on a list of\n * components, then pass the `totalItems` as the total components in the list.\n * later, during the iteration, call `logProgress(componentName)`.\n * once done, call `end()`.\n * the status-line will show all messages in the terminal.\n * see README for more data.\n */\nexport class LongProcessLogger {\n constructor(\n private logPublisher: Logger,\n private extensionName: string,\n private processDescription: string,\n private totalItems?: number,\n private currentItem = 0,\n private startTime = process.hrtime()\n ) {\n this.start();\n }\n\n logProgress(itemName = '') {\n this.currentItem += 1;\n const message = `${this.processDescription} (${this.currentItem}/${this.totalItems}). ${itemName}`;\n this.logPublisher.debug(message);\n this.logPublisher.setStatusLine(`${this.extensionName}, ${message}`);\n }\n\n end(alternateDescriptionPrefix?: string) {\n const description = alternateDescriptionPrefix || this.processDescription;\n const duration = process.hrtime(this.startTime);\n const message = `${description} (completed in ${prettyTime(duration)})`;\n this.logAndConsole(message);\n }\n\n private start() {\n const totalItemsStr = this.totalItems ? `(total: ${this.totalItems})` : '';\n const message = `${this.processDescription} ${totalItemsStr}`;\n this.logAndConsole(message);\n }\n\n private logAndConsole(message: string) {\n this.logPublisher.info(message);\n this.logPublisher.setStatusLine(`${this.extensionName}, ${message}`);\n }\n}\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,iBAAiB,CAAC;EAC7BC,WAAW,CACDC,YAAoB,EACpBC,aAAqB,EACrBC,kBAA0B,EAC1BC,UAAmB,EACnBC,WAAW,GAAG,CAAC,EACfC,SAAS,GAAGC,OAAO,CAACC,MAAM,EAAE,EACpC;IAAA,KANQP,YAAoB,GAApBA,YAAoB;IAAA,KACpBC,aAAqB,GAArBA,aAAqB;IAAA,KACrBC,kBAA0B,GAA1BA,kBAA0B;IAAA,KAC1BC,UAAmB,GAAnBA,UAAmB;IAAA,KACnBC,WAAW,GAAXA,WAAW;IAAA,KACXC,SAAS,GAATA,SAAS;IAEjB,IAAI,CAACG,KAAK,EAAE;EACd;EAEAC,WAAW,CAACC,QAAQ,GAAG,EAAE,EAAE;IACzB,IAAI,CAACN,WAAW,IAAI,CAAC;IACrB,MAAMO,OAAO,GAAI,GAAE,IAAI,CAACT,kBAAmB,KAAI,IAAI,CAACE,WAAY,IAAG,IAAI,CAACD,UAAW,MAAKO,QAAS,EAAC;IAClG,IAAI,CAACV,YAAY,CAACY,KAAK,CAACD,OAAO,CAAC;IAChC,IAAI,CAACX,YAAY,CAACa,aAAa,CAAE,GAAE,IAAI,CAACZ,aAAc,KAAIU,OAAQ,EAAC,CAAC;EACtE;EAEAG,GAAG,CAACC,0BAAmC,EAAE;IACvC,MAAMC,WAAW,GAAGD,0BAA0B,IAAI,IAAI,CAACb,kBAAkB;IACzE,MAAMe,QAAQ,GAAGX,OAAO,CAACC,MAAM,CAAC,IAAI,CAACF,SAAS,CAAC;IAC/C,MAAMM,OAAO,GAAI,GAAEK,WAAY,kBAAiB,IAAAE,qBAAU,EAACD,QAAQ,CAAE,GAAE;IACvE,IAAI,CAACE,aAAa,CAACR,OAAO,CAAC;EAC7B;EAEQH,KAAK,GAAG;IACd,MAAMY,aAAa,GAAG,IAAI,CAACjB,UAAU,GAAI,WAAU,IAAI,CAACA,UAAW,GAAE,GAAG,EAAE;IAC1E,MAAMQ,OAAO,GAAI,GAAE,IAAI,CAACT,kBAAmB,IAAGkB,aAAc,EAAC;IAC7D,IAAI,CAACD,aAAa,CAACR,OAAO,CAAC;EAC7B;EAEQQ,aAAa,CAACR,OAAe,EAAE;IACrC,IAAI,CAACX,YAAY,CAACqB,IAAI,CAACV,OAAO,CAAC;IAC/B,IAAI,CAACX,YAAY,CAACa,aAAa,CAAE,GAAE,IAAI,CAACZ,aAAc,KAAIU,OAAQ,EAAC,CAAC;EACtE;AACF;AAAC"}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_logger@0.0.778/dist/logger.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_logger@0.0.778/dist/logger.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_logger@0.0.780/dist/logger.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_logger@0.0.780/dist/logger.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/logger",
3
- "version": "0.0.778",
3
+ "version": "0.0.780",
4
4
  "homepage": "https://bit.dev/teambit/harmony/logger",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.harmony",
8
8
  "name": "logger",
9
- "version": "0.0.778"
9
+ "version": "0.0.780"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -14,7 +14,7 @@
14
14
  "core-js": "^3.0.0",
15
15
  "@babel/runtime": "7.20.0",
16
16
  "@teambit/harmony": "0.4.6",
17
- "@teambit/cli": "0.0.685"
17
+ "@teambit/cli": "0.0.687"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@types/react": "^17.0.8",
@@ -26,7 +26,7 @@
26
26
  "@teambit/harmony.aspect-docs.logger": "0.0.151"
27
27
  },
28
28
  "peerDependencies": {
29
- "@teambit/legacy": "1.0.465",
29
+ "@teambit/legacy": "1.0.467",
30
30
  "react": "^16.8.0 || ^17.0.0",
31
31
  "react-dom": "^16.8.0 || ^17.0.0"
32
32
  },