@teambit/logger 0.0.684 → 0.0.686

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/index.js CHANGED
@@ -21,34 +21,25 @@ Object.defineProperty(exports, "LongProcessLogger", {
21
21
  return _longProcessLogger().LongProcessLogger;
22
22
  }
23
23
  });
24
-
25
24
  function _logger() {
26
25
  const data = require("./logger");
27
-
28
26
  _logger = function () {
29
27
  return data;
30
28
  };
31
-
32
29
  return data;
33
30
  }
34
-
35
31
  function _logger2() {
36
32
  const data = require("./logger.aspect");
37
-
38
33
  _logger2 = function () {
39
34
  return data;
40
35
  };
41
-
42
36
  return data;
43
37
  }
44
-
45
38
  function _longProcessLogger() {
46
39
  const data = require("./long-process-logger");
47
-
48
40
  _longProcessLogger = function () {
49
41
  return data;
50
42
  };
51
-
52
43
  return data;
53
44
  }
54
45
 
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { Logger } from './logger';\nexport type { LoggerMain } from './logger.main.runtime';\nexport { LoggerAspect } from './logger.aspect';\nexport { LongProcessLogger } from './long-process-logger';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA"}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { Logger } from './logger';\nexport type { LoggerMain } from './logger.main.runtime';\nexport { LoggerAspect } from './logger.aspect';\nexport { LongProcessLogger } from './long-process-logger';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
@@ -4,23 +4,18 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.LoggerAspect = void 0;
7
-
8
7
  function _harmony() {
9
8
  const data = require("@teambit/harmony");
10
-
11
9
  _harmony = function () {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  const LoggerAspect = _harmony().Aspect.create({
19
15
  id: 'teambit.harmony/logger',
20
16
  dependencies: [],
21
17
  defaultConfig: {}
22
18
  });
23
-
24
19
  exports.LoggerAspect = LoggerAspect;
25
20
 
26
21
  //# sourceMappingURL=logger.aspect.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["LoggerAspect","Aspect","create","id","dependencies","defaultConfig"],"sources":["logger.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const LoggerAspect = Aspect.create({\n id: 'teambit.harmony/logger',\n dependencies: [],\n defaultConfig: {},\n});\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,YAAY,GAAGC,iBAAA,CAAOC,MAAP,CAAc;EACxCC,EAAE,EAAE,wBADoC;EAExCC,YAAY,EAAE,EAF0B;EAGxCC,aAAa,EAAE;AAHyB,CAAd,CAArB"}
1
+ {"version":3,"names":["LoggerAspect","Aspect","create","id","dependencies","defaultConfig"],"sources":["logger.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const LoggerAspect = Aspect.create({\n id: 'teambit.harmony/logger',\n dependencies: [],\n defaultConfig: {},\n});\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,YAAY,GAAGC,iBAAM,CAACC,MAAM,CAAC;EACxCC,EAAE,EAAE,wBAAwB;EAC5BC,YAAY,EAAE,EAAE;EAChBC,aAAa,EAAE,CAAC;AAClB,CAAC,CAAC;AAAC"}
@@ -1,22 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.Logo = void 0;
9
-
10
8
  function _react() {
11
9
  const data = _interopRequireDefault(require("react"));
12
-
13
10
  _react = function () {
14
11
  return data;
15
12
  };
16
-
17
13
  return data;
18
14
  }
19
-
20
15
  const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
21
16
  style: {
22
17
  height: '100%',
@@ -29,7 +24,6 @@ const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
29
24
  },
30
25
  src: "https://static.bit.dev/extensions-icons/logger.svg"
31
26
  }));
32
-
33
27
  exports.Logo = Logo;
34
28
 
35
29
  //# sourceMappingURL=logger.composition.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["logger.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/logger.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAV;IAAkBC,OAAO,EAAE,MAA3B;IAAmCC,cAAc,EAAE;EAAnD;AAAZ,gBACE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAT,CAAZ;EAA2B,GAAG,EAAC;AAA/B,EADF,CADK"}
1
+ {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["logger.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/logger.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAG,CAAE;EAAC,GAAG,EAAC;AAAoD,EAAG,CAEzF;AAAC"}
package/dist/logger.js CHANGED
@@ -1,83 +1,61 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  require("core-js/modules/es.array.iterator.js");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.Logger = void 0;
11
-
12
9
  function _loader() {
13
10
  const data = _interopRequireDefault(require("@teambit/legacy/dist/cli/loader"));
14
-
15
11
  _loader = function () {
16
12
  return data;
17
13
  };
18
-
19
14
  return data;
20
15
  }
21
-
22
16
  function _logger() {
23
17
  const data = _interopRequireDefault(require("@teambit/legacy/dist/logger/logger"));
24
-
25
18
  _logger = function () {
26
19
  return data;
27
20
  };
28
-
29
21
  return data;
30
22
  }
31
-
32
23
  function _chalk() {
33
24
  const data = _interopRequireDefault(require("chalk"));
34
-
35
25
  _chalk = function () {
36
26
  return data;
37
27
  };
38
-
39
28
  return data;
40
29
  }
41
-
42
30
  function _longProcessLogger() {
43
31
  const data = require("./long-process-logger");
44
-
45
32
  _longProcessLogger = function () {
46
33
  return data;
47
34
  };
48
-
49
35
  return data;
50
36
  }
51
-
52
37
  class Logger {
53
38
  constructor(extensionName) {
54
39
  this.extensionName = extensionName;
55
40
  }
56
-
57
41
  trace(message, ...meta) {
58
42
  _logger().default.trace(this.colorMessage(message), ...meta);
59
43
  }
60
-
61
44
  debug(message, ...meta) {
62
45
  _logger().default.debug(this.colorMessage(message), ...meta);
63
46
  }
64
-
65
47
  info(message, ...meta) {
66
48
  _logger().default.info(this.colorMessage(message), ...meta);
67
49
  }
68
-
69
50
  warn(message, ...meta) {
70
51
  _logger().default.warn(this.colorMessage(message), ...meta);
71
52
  }
72
-
73
53
  error(message, ...meta) {
74
54
  _logger().default.error(this.colorMessage(message), ...meta);
75
55
  }
76
-
77
56
  fatal(message, ...meta) {
78
57
  _logger().default.fatal(this.colorMessage(message), ...meta);
79
58
  }
80
-
81
59
  get isLoaderStarted() {
82
60
  return _loader().default.isStarted;
83
61
  }
@@ -89,8 +67,6 @@ class Logger {
89
67
  * once done, call `LongProcessLogger.end()`
90
68
  * the status-line will show all messages in the terminal.
91
69
  */
92
-
93
-
94
70
  createLongProcessLogger(processDescription, totalItems) {
95
71
  return new (_longProcessLogger().LongProcessLogger)(this, this.extensionName, processDescription, totalItems);
96
72
  }
@@ -98,27 +74,20 @@ class Logger {
98
74
  * single status-line on the bottom of the screen.
99
75
  * the text is replaced every time this method is called.
100
76
  */
101
-
102
-
103
77
  setStatusLine(text) {
104
78
  _loader().default.setTextAndRestart(text);
105
79
  }
106
80
  /**
107
81
  * remove the text from the last line on the screen.
108
82
  */
109
-
110
-
111
83
  clearStatusLine() {
112
84
  _loader().default.stop();
113
85
  }
114
86
  /**
115
87
  * print to the screen. if message is empty, print the last logged message.
116
88
  */
117
-
118
-
119
89
  console(message, ...meta) {
120
90
  if (message) this.info(message, meta);
121
-
122
91
  if (!_loader().default.isStarted && _logger().default.shouldWriteToConsole) {
123
92
  // eslint-disable-next-line no-console
124
93
  console.log(message, ...meta);
@@ -128,10 +97,8 @@ class Logger {
128
97
  });
129
98
  }
130
99
  }
131
-
132
100
  consoleWarn(message, ...meta) {
133
101
  if (message) this.warn(message, ...meta);
134
-
135
102
  if (!_loader().default.isStarted && _logger().default.shouldWriteToConsole) {
136
103
  // eslint-disable-next-line no-console
137
104
  console.warn(message, ...meta);
@@ -141,10 +108,8 @@ class Logger {
141
108
  });
142
109
  }
143
110
  }
144
-
145
111
  consoleError(message, ...meta) {
146
112
  if (message) this.error(message, ...meta);
147
-
148
113
  if (!_loader().default.isStarted && _logger().default.shouldWriteToConsole) {
149
114
  // eslint-disable-next-line no-console
150
115
  console.error(message, ...meta);
@@ -154,14 +119,12 @@ class Logger {
154
119
  });
155
120
  }
156
121
  }
122
+
157
123
  /**
158
124
  * print to the screen as a title, with bold text.
159
125
  */
160
-
161
-
162
126
  consoleTitle(message) {
163
127
  this.info(message);
164
-
165
128
  _loader().default.stopAndPersist({
166
129
  text: _chalk().default.bold(message)
167
130
  });
@@ -169,60 +132,46 @@ class Logger {
169
132
  /**
170
133
  * print to the screen with a green `✔` prefix. if message is empty, print the last logged message.
171
134
  */
172
-
173
-
174
135
  consoleSuccess(message) {
175
136
  if (message) this.info(message);
176
-
177
137
  _loader().default.succeed(message);
178
138
  }
139
+
179
140
  /**
180
141
  * turn off the logger.
181
142
  */
182
-
183
-
184
143
  off() {
185
144
  return _loader().default.off();
186
145
  }
187
-
188
146
  on() {
189
147
  return _loader().default.on();
190
148
  }
191
-
192
149
  profile(id, console) {
193
150
  _logger().default.profile(id, console);
194
151
  }
152
+
195
153
  /**
196
154
  * print to the screen with a red `✖` prefix. if message is empty, print the last logged message.
197
155
  */
198
-
199
-
200
156
  consoleFailure(message) {
201
157
  if (message) this.error(message);
202
-
203
158
  _loader().default.fail(message);
204
159
  }
205
160
  /**
206
161
  * print to the screen with a red `⚠` prefix. if message is empty, print the last logged message.
207
162
  */
208
-
209
-
210
163
  consoleWarning(message) {
211
164
  if (message) {
212
165
  this.warn(message);
213
166
  message = _chalk().default.yellow(message);
214
167
  }
215
-
216
168
  _loader().default.warn(message);
217
169
  }
218
-
219
170
  colorMessage(message) {
220
171
  if (_logger().default.isJsonFormat) return `${this.extensionName}, ${message}`;
221
172
  return `${_chalk().default.bold(this.extensionName)}, ${message}`;
222
173
  }
223
-
224
174
  }
225
-
226
175
  exports.Logger = Logger;
227
176
 
228
177
  //# sourceMappingURL=logger.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Logger","constructor","extensionName","trace","message","meta","logger","colorMessage","debug","info","warn","error","fatal","isLoaderStarted","loader","isStarted","createLongProcessLogger","processDescription","totalItems","LongProcessLogger","setStatusLine","text","setTextAndRestart","clearStatusLine","stop","console","shouldWriteToConsole","log","stopAndPersist","consoleWarn","consoleError","consoleTitle","chalk","bold","consoleSuccess","succeed","off","on","profile","id","consoleFailure","fail","consoleWarning","yellow","isJsonFormat"],"sources":["logger.ts"],"sourcesContent":["import loader from '@teambit/legacy/dist/cli/loader';\nimport logger, { IBitLogger } from '@teambit/legacy/dist/logger/logger';\nimport chalk from 'chalk';\n\nimport { LongProcessLogger } from './long-process-logger';\n\nexport class Logger implements IBitLogger {\n constructor(private extensionName: string) {}\n\n trace(message: string, ...meta: any[]) {\n logger.trace(this.colorMessage(message), ...meta);\n }\n debug(message: string, ...meta: any[]) {\n logger.debug(this.colorMessage(message), ...meta);\n }\n info(message: string, ...meta: any[]) {\n logger.info(this.colorMessage(message), ...meta);\n }\n warn(message: string, ...meta: any[]) {\n logger.warn(this.colorMessage(message), ...meta);\n }\n error(message: string, ...meta: any[]) {\n logger.error(this.colorMessage(message), ...meta);\n }\n fatal(message: string, ...meta: any[]) {\n logger.fatal(this.colorMessage(message), ...meta);\n }\n\n get isLoaderStarted() {\n return loader.isStarted;\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 of the total components in the list.\n * later, during the iteration, call `LongProcessLogger.logProgress(componentName)`.\n * once done, call `LongProcessLogger.end()`\n * the status-line will show all messages in the terminal.\n */\n createLongProcessLogger(processDescription: string, totalItems?: number): LongProcessLogger {\n return new LongProcessLogger(this, this.extensionName, processDescription, totalItems);\n }\n /**\n * single status-line on the bottom of the screen.\n * the text is replaced every time this method is called.\n */\n setStatusLine(text: string) {\n loader.setTextAndRestart(text);\n }\n /**\n * remove the text from the last line on the screen.\n */\n clearStatusLine() {\n loader.stop();\n }\n /**\n * print to the screen. if message is empty, print the last logged message.\n */\n console(message?: string, ...meta: any[]) {\n if (message) this.info(message, meta);\n if (!loader.isStarted && logger.shouldWriteToConsole) {\n // eslint-disable-next-line no-console\n console.log(message, ...meta);\n } else {\n loader.stopAndPersist({ text: message });\n }\n }\n\n consoleWarn(message?: string, ...meta: any[]) {\n if (message) this.warn(message, ...meta);\n if (!loader.isStarted && logger.shouldWriteToConsole) {\n // eslint-disable-next-line no-console\n console.warn(message, ...meta);\n } else {\n loader.stopAndPersist({ text: message });\n }\n }\n\n consoleError(message?: string, ...meta: any[]) {\n if (message) this.error(message, ...meta);\n if (!loader.isStarted && logger.shouldWriteToConsole) {\n // eslint-disable-next-line no-console\n console.error(message, ...meta);\n } else {\n loader.stopAndPersist({ text: message });\n }\n }\n\n /**\n * print to the screen as a title, with bold text.\n */\n consoleTitle(message: string) {\n this.info(message);\n loader.stopAndPersist({ text: chalk.bold(message) });\n }\n /**\n * print to the screen with a green `✔` prefix. if message is empty, print the last logged message.\n */\n consoleSuccess(message?: string) {\n if (message) this.info(message);\n loader.succeed(message);\n }\n\n /**\n * turn off the logger.\n */\n off() {\n return loader.off();\n }\n\n on() {\n return loader.on();\n }\n\n profile(id: string, console?: boolean) {\n logger.profile(id, console);\n }\n\n /**\n * print to the screen with a red `✖` prefix. if message is empty, print the last logged message.\n */\n consoleFailure(message?: string) {\n if (message) this.error(message);\n loader.fail(message);\n }\n /**\n * print to the screen with a red `⚠` prefix. if message is empty, print the last logged message.\n */\n consoleWarning(message?: string) {\n if (message) {\n this.warn(message);\n message = chalk.yellow(message);\n }\n loader.warn(message);\n }\n\n private colorMessage(message: string) {\n if (logger.isJsonFormat) return `${this.extensionName}, ${message}`;\n return `${chalk.bold(this.extensionName)}, ${message}`;\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,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N,CAAW,KAAK/B,aAAhB,CAA+B,KAAIE,OAAQ,EAArD;EACD;;AArIuC"}
1
+ {"version":3,"names":["Logger","constructor","extensionName","trace","message","meta","logger","colorMessage","debug","info","warn","error","fatal","isLoaderStarted","loader","isStarted","createLongProcessLogger","processDescription","totalItems","LongProcessLogger","setStatusLine","text","setTextAndRestart","clearStatusLine","stop","console","shouldWriteToConsole","log","stopAndPersist","consoleWarn","consoleError","consoleTitle","chalk","bold","consoleSuccess","succeed","off","on","profile","id","consoleFailure","fail","consoleWarning","yellow","isJsonFormat"],"sources":["logger.ts"],"sourcesContent":["import loader from '@teambit/legacy/dist/cli/loader';\nimport logger, { IBitLogger } from '@teambit/legacy/dist/logger/logger';\nimport chalk from 'chalk';\n\nimport { LongProcessLogger } from './long-process-logger';\n\nexport class Logger implements IBitLogger {\n constructor(private extensionName: string) {}\n\n trace(message: string, ...meta: any[]) {\n logger.trace(this.colorMessage(message), ...meta);\n }\n debug(message: string, ...meta: any[]) {\n logger.debug(this.colorMessage(message), ...meta);\n }\n info(message: string, ...meta: any[]) {\n logger.info(this.colorMessage(message), ...meta);\n }\n warn(message: string, ...meta: any[]) {\n logger.warn(this.colorMessage(message), ...meta);\n }\n error(message: string, ...meta: any[]) {\n logger.error(this.colorMessage(message), ...meta);\n }\n fatal(message: string, ...meta: any[]) {\n logger.fatal(this.colorMessage(message), ...meta);\n }\n\n get isLoaderStarted() {\n return loader.isStarted;\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 of the total components in the list.\n * later, during the iteration, call `LongProcessLogger.logProgress(componentName)`.\n * once done, call `LongProcessLogger.end()`\n * the status-line will show all messages in the terminal.\n */\n createLongProcessLogger(processDescription: string, totalItems?: number): LongProcessLogger {\n return new LongProcessLogger(this, this.extensionName, processDescription, totalItems);\n }\n /**\n * single status-line on the bottom of the screen.\n * the text is replaced every time this method is called.\n */\n setStatusLine(text: string) {\n loader.setTextAndRestart(text);\n }\n /**\n * remove the text from the last line on the screen.\n */\n clearStatusLine() {\n loader.stop();\n }\n /**\n * print to the screen. if message is empty, print the last logged message.\n */\n console(message?: string, ...meta: any[]) {\n if (message) this.info(message, meta);\n if (!loader.isStarted && logger.shouldWriteToConsole) {\n // eslint-disable-next-line no-console\n console.log(message, ...meta);\n } else {\n loader.stopAndPersist({ text: message });\n }\n }\n\n consoleWarn(message?: string, ...meta: any[]) {\n if (message) this.warn(message, ...meta);\n if (!loader.isStarted && logger.shouldWriteToConsole) {\n // eslint-disable-next-line no-console\n console.warn(message, ...meta);\n } else {\n loader.stopAndPersist({ text: message });\n }\n }\n\n consoleError(message?: string, ...meta: any[]) {\n if (message) this.error(message, ...meta);\n if (!loader.isStarted && logger.shouldWriteToConsole) {\n // eslint-disable-next-line no-console\n console.error(message, ...meta);\n } else {\n loader.stopAndPersist({ text: message });\n }\n }\n\n /**\n * print to the screen as a title, with bold text.\n */\n consoleTitle(message: string) {\n this.info(message);\n loader.stopAndPersist({ text: chalk.bold(message) });\n }\n /**\n * print to the screen with a green `✔` prefix. if message is empty, print the last logged message.\n */\n consoleSuccess(message?: string) {\n if (message) this.info(message);\n loader.succeed(message);\n }\n\n /**\n * turn off the logger.\n */\n off() {\n return loader.off();\n }\n\n on() {\n return loader.on();\n }\n\n profile(id: string, console?: boolean) {\n logger.profile(id, console);\n }\n\n /**\n * print to the screen with a red `✖` prefix. if message is empty, print the last logged message.\n */\n consoleFailure(message?: string) {\n if (message) this.error(message);\n loader.fail(message);\n }\n /**\n * print to the screen with a red `⚠` prefix. if message is empty, print the last logged message.\n */\n consoleWarning(message?: string) {\n if (message) {\n this.warn(message);\n message = chalk.yellow(message);\n }\n loader.warn(message);\n }\n\n private colorMessage(message: string) {\n if (logger.isJsonFormat) return `${this.extensionName}, ${message}`;\n return `${chalk.bold(this.extensionName)}, ${message}`;\n }\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;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BAAM,CAACJ,IAAI,CAACN,OAAO,CAAC;EACtB;EAEQG,YAAY,CAACH,OAAe,EAAE;IACpC,IAAIE,iBAAM,CAACsC,YAAY,EAAE,OAAQ,GAAE,IAAI,CAAC1C,aAAc,KAAIE,OAAQ,EAAC;IACnE,OAAQ,GAAE4B,gBAAK,CAACC,IAAI,CAAC,IAAI,CAAC/B,aAAa,CAAE,KAAIE,OAAQ,EAAC;EACxD;AACF;AAAC"}
@@ -1,69 +1,50 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  require("core-js/modules/es.promise.js");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.LoggerMain = void 0;
11
-
12
9
  function _defineProperty2() {
13
10
  const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
-
15
11
  _defineProperty2 = function () {
16
12
  return data;
17
13
  };
18
-
19
14
  return data;
20
15
  }
21
-
22
16
  function _cli() {
23
17
  const data = require("@teambit/cli");
24
-
25
18
  _cli = function () {
26
19
  return data;
27
20
  };
28
-
29
21
  return data;
30
22
  }
31
-
32
23
  function _logger() {
33
24
  const data = require("./logger");
34
-
35
25
  _logger = function () {
36
26
  return data;
37
27
  };
38
-
39
28
  return data;
40
29
  }
41
-
42
30
  function _logger2() {
43
31
  const data = require("./logger.aspect");
44
-
45
32
  _logger2 = function () {
46
33
  return data;
47
34
  };
48
-
49
35
  return data;
50
36
  }
51
-
52
37
  class LoggerMain {
53
38
  createLogger(extensionName) {
54
39
  return new (_logger().Logger)(extensionName);
55
40
  }
56
-
57
41
  static async provider() {
58
42
  return new LoggerMain();
59
43
  }
60
-
61
44
  }
62
-
63
45
  exports.LoggerMain = LoggerMain;
64
46
  (0, _defineProperty2().default)(LoggerMain, "runtime", _cli().MainRuntime);
65
47
  (0, _defineProperty2().default)(LoggerMain, "dependencies", []);
66
-
67
48
  _logger2().LoggerAspect.addRuntime(LoggerMain);
68
49
 
69
50
  //# sourceMappingURL=logger.main.runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["LoggerMain","createLogger","extensionName","Logger","provider","MainRuntime","LoggerAspect","addRuntime"],"sources":["logger.main.runtime.ts"],"sourcesContent":["import { MainRuntime } from '@teambit/cli';\n\nimport { Logger } from './logger';\nimport { LoggerAspect } from './logger.aspect';\n\nexport class LoggerMain {\n static runtime = MainRuntime;\n static dependencies = [];\n\n createLogger(extensionName: string): Logger {\n return new Logger(extensionName);\n }\n\n static async provider() {\n return new LoggerMain();\n }\n}\n\nLoggerAspect.addRuntime(LoggerMain);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,UAAN,CAAiB;EAItBC,YAAY,CAACC,aAAD,EAAgC;IAC1C,OAAO,KAAIC,gBAAJ,EAAWD,aAAX,CAAP;EACD;;EAEoB,aAARE,QAAQ,GAAG;IACtB,OAAO,IAAIJ,UAAJ,EAAP;EACD;;AAVqB;;;gCAAXA,U,aACMK,kB;gCADNL,U,kBAEW,E;;AAWxBM,uBAAA,CAAaC,UAAb,CAAwBP,UAAxB"}
1
+ {"version":3,"names":["LoggerMain","createLogger","extensionName","Logger","provider","MainRuntime","LoggerAspect","addRuntime"],"sources":["logger.main.runtime.ts"],"sourcesContent":["import { MainRuntime } from '@teambit/cli';\n\nimport { Logger } from './logger';\nimport { LoggerAspect } from './logger.aspect';\n\nexport class LoggerMain {\n static runtime = MainRuntime;\n static dependencies = [];\n\n createLogger(extensionName: string): Logger {\n return new Logger(extensionName);\n }\n\n static async provider() {\n return new LoggerMain();\n }\n}\n\nLoggerAspect.addRuntime(LoggerMain);\n"],"mappings":";;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,UAAU,CAAC;EAItBC,YAAY,CAACC,aAAqB,EAAU;IAC1C,OAAO,KAAIC,gBAAM,EAACD,aAAa,CAAC;EAClC;EAEA,aAAaE,QAAQ,GAAG;IACtB,OAAO,IAAIJ,UAAU,EAAE;EACzB;AACF;AAAC;AAAA,gCAXYA,UAAU,aACJK,kBAAW;AAAA,gCADjBL,UAAU,kBAEC,EAAE;AAW1BM,uBAAY,CAACC,UAAU,CAACP,UAAU,CAAC"}
@@ -1,22 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.LongProcessLogger = void 0;
9
-
10
8
  function _prettyTime() {
11
9
  const data = _interopRequireDefault(require("pretty-time"));
12
-
13
10
  _prettyTime = function () {
14
11
  return data;
15
12
  };
16
-
17
13
  return data;
18
14
  }
19
-
20
15
  /**
21
16
  * use it for a long running process. upon creation it logs the `processDescription`.
22
17
  * if the process involves iteration over a list of items, such as running tag on a list of
@@ -36,33 +31,27 @@ class LongProcessLogger {
36
31
  this.startTime = startTime;
37
32
  this.start();
38
33
  }
39
-
40
34
  logProgress(itemName = '') {
41
35
  this.currentItem += 1;
42
36
  const message = `${this.processDescription} (${this.currentItem}/${this.totalItems}). ${itemName}`;
43
37
  this.logPublisher.debug(message);
44
38
  this.logPublisher.setStatusLine(`${this.extensionName}, ${message}`);
45
39
  }
46
-
47
40
  end() {
48
41
  const duration = process.hrtime(this.startTime);
49
42
  const message = `${this.processDescription} (completed in ${(0, _prettyTime().default)(duration)})`;
50
43
  this.logAndConsole(message);
51
44
  }
52
-
53
45
  start() {
54
46
  const totalItemsStr = this.totalItems ? `(total: ${this.totalItems})` : '';
55
47
  const message = `${this.processDescription} ${totalItemsStr}`;
56
48
  this.logAndConsole(message);
57
49
  }
58
-
59
50
  logAndConsole(message) {
60
51
  this.logPublisher.info(message);
61
52
  this.logPublisher.setStatusLine(`${this.extensionName}, ${message}`);
62
53
  }
63
-
64
54
  }
65
-
66
55
  exports.LongProcessLogger = LongProcessLogger;
67
56
 
68
57
  //# sourceMappingURL=long-process-logger.js.map
@@ -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;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AL,CAAkBmB,IAAlB,CAAuBR,OAAvB;IACA,KAAKX,YAAL,CAAkBa,aAAlB,CAAiC,GAAE,KAAKZ,aAAc,KAAIU,OAAQ,EAAlE;EACD;;AAlC4B"}
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,a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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"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/logger",
3
- "version": "0.0.684",
3
+ "version": "0.0.686",
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.684"
9
+ "version": "0.0.686"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
@@ -14,7 +14,7 @@
14
14
  "@babel/runtime": "7.12.18",
15
15
  "core-js": "^3.0.0",
16
16
  "@teambit/harmony": "0.3.3",
17
- "@teambit/cli": "0.0.591"
17
+ "@teambit/cli": "0.0.593"
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.146"
27
27
  },
28
28
  "peerDependencies": {
29
- "@teambit/legacy": "1.0.374",
29
+ "@teambit/legacy": "1.0.376",
30
30
  "react-dom": "^16.8.0 || ^17.0.0",
31
31
  "react": "^16.8.0 || ^17.0.0"
32
32
  },
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_logger@0.0.684/dist/logger.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_logger@0.0.684/dist/logger.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_logger@0.0.686/dist/logger.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_logger@0.0.686/dist/logger.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];