@teambit/harmony.aspect-docs.logger 0.0.170 → 0.0.171

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.
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_react2","_excluded","e","__esModule","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_objectWithoutProperties","o","i","_objectWithoutPropertiesLoose","getOwnPropertySymbols","s","includes","propertyIsEnumerable","layoutProps","MDXLayout","MDXContent","_ref","components","props","mdx","mdxType","parentName","isMDXComponent"],"sourceRoot":"/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_aspect-docs_logger@0.0.170","sources":["logger.mdx.js"],"sourcesContent":["\n// @ts-nocheck\nimport React from 'react'\nimport { mdx } from '@mdx-js/react'\n\n/* @jsxRuntime classic */\n/* @jsx mdx */\n\n\n\n\nconst layoutProps = {\n \n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return <MDXLayout {...layoutProps} {...props} components={components} mdxType=\"MDXLayout\">\n <h2>{`Create a logger`}</h2>\n <p>{`In your extension, add `}<inlineCode parentName=\"p\">{`LoggerMain`}</inlineCode>{` as a dependency and create a new logger by running`}</p>\n <pre><code parentName=\"pre\" {...{}}>{`LoggerMain.createLogger('your-extension-id');\n`}</code></pre>\n <h2>{`Log to a file`}</h2>\n <p>{`The following standard methods are available to log into a file. By default it's the `}<inlineCode parentName=\"p\">{`debug.log`}</inlineCode>{` file located at `}<inlineCode parentName=\"p\">{`~/Library/Caches/Bit/logs`}</inlineCode>{` for Mac/Linux or `}<inlineCode parentName=\"p\">{`%LOCALAPPDATA%\\\\Bit`}</inlineCode>{` for Windows.`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-ts\"\n }}>{`logger.trace(message: string, ...meta: any[]);\nlogger.debug(message: string, ...meta: any[]);\nlogger.info(message: string, ...meta: any[]);\nlogger.warn(message: string, ...meta: any[]);\nlogger.error(message: string, ...meta: any[]);\n`}</code></pre>\n <p>{`The message color is coded uniquely per extension-id. This way, it's easier to scroll the logs and distinguish between the extensions.`}</p>\n <p>{`The format of the message logged to the file is `}<strong parentName=\"p\">{`\"TIMESTAMP LEVEL: EXT-ID, MSG `}{`[META]`}{`\"`}</strong>{`. The \"`}{`[META]`}{`\" part is `}<inlineCode parentName=\"p\">{`JSON.stringify`}</inlineCode>{` of the second parameter in case it's an object. Otherwise, it's ignored.`}</p>\n <p>{`JSON format is available as well. To use it, run `}<inlineCode parentName=\"p\">{`bit config set log_json_format true`}</inlineCode>{`.`}</p>\n <p>{`It's possible to have the console as an extra layer so these messages will be printed to the screen as well, see below.`}</p>\n <h3>{`Log stack trace`}</h3>\n <p>{`Normally, there is no need to log the Error object because it being caught by the end of the process and gets logged by Bit. Sometimes though it is needed to locally catch the error and continue, which can be useful to log the entire error object include the stack trace. In which case, pass the error object as the second parameter. e.g. `}<inlineCode parentName=\"p\">{`catch(err) { logger.error('got an error during component-load', err); }`}</inlineCode></p>\n <h3>{`Log also to the console`}</h3>\n <p>{`To see the same massages above printed into the screen, use the global flag `}<inlineCode parentName=\"p\">{`--log [level]`}</inlineCode>{`. For example, `}<inlineCode parentName=\"p\">{`bit status --log=error`}</inlineCode>{`. If the level was not entered, it defaults to `}<inlineCode parentName=\"p\">{`info`}</inlineCode>{`.`}</p>\n <p>{`Alternatively, you can set an environment variable `}<inlineCode parentName=\"p\">{`BIT_LOG`}</inlineCode>{` with the desired level.`}</p>\n <p>{`The format of the message logged to the console is `}<strong parentName=\"p\">{`\"MSG `}{`[META]`}{`\"`}</strong>{` The \"`}{`[META]`}{`\" part is the same as above.`}</p>\n <h2>{`Report progress`}</h2>\n <p>{`During the command execution it's helpful to see the progress on the screen. The following options log to the file and in addition, print to the screen. Use only these methods and avoid calling `}<inlineCode parentName=\"p\">{`console.log`}</inlineCode>{` to not break the output (or potentially the JSON structure).`}</p>\n <blockquote>\n <p parentName=\"blockquote\">{`Please note that these methods print to the screen only when a command is not considered \"internal\" (such commands normally run on the remote server) and when a command is not used with `}<inlineCode parentName=\"p\">{`--json`}</inlineCode>{` flag. To specifically disable console-printing to a command, set the `}<inlineCode parentName=\"p\">{`loader`}</inlineCode>{` property to `}<inlineCode parentName=\"p\">{`false`}</inlineCode>{`.`}</p>\n </blockquote>\n <h3>{`Status Line (spinner)`}</h3>\n <p>{`The status-line is a single line on the bottom of the screen, with a spinner/loader prefix. It's changing constantly during the command execution. This is the main indicator for the end-user of what's going on at the moment.`}</p>\n <p>{`To set the text of this status-line, call:`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-js\"\n }}>{`logger.setStatusLine((text: string));\n`}</code></pre>\n <p>{`Once the command completed, the spinner is stopped and the status-line is cleared. Then, the command results are printed. If, for some reason, it is needed to clear the status-line before, just call `}<inlineCode parentName=\"p\">{`logger.clearStatusLine()`}</inlineCode>{`.`}</p>\n <h3>{`Persist text`}</h3>\n <p>{`Sometimes it's helpful to indicate that a phase has completed. Either successfully or failed. The following methods help with this:`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-js\"\n }}>{`// print to the screen with a green \\`✔\\` prefix. if message is empty, print the last logged message.\nlogger.consoleSuccess(message?: string);\n\n// print to the screen with a red \\`✖\\` prefix. if message is empty, print the last logged message.\nlogger.consoleFailure(message?: string);\n`}</code></pre>\n <p>{`To print without any prefix, use `}<inlineCode parentName=\"p\">{`logger.console(message);`}</inlineCode></p>\n <h3>{`Long Running Process Logger`}</h3>\n <p>{`Run the following to get an instance of the `}<inlineCode parentName=\"p\">{`LongProcessLogger`}</inlineCode>{` and start logging the process description.`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-js\"\n }}>{`logger.createLongProcessLogger(processDescription: string, totalItems?: number): LongProcessLogger;\n`}</code></pre>\n <p>{`If the process involves iteration over a list of items, such as running tag on a list of components, then pass the `}<inlineCode parentName=\"p\">{`totalItems`}</inlineCode>{` as the total number of the components in the list.`}</p>\n <p>{`Later, during the iteration, call `}<inlineCode parentName=\"p\">{`logProgress(componentName)`}</inlineCode>{` on the `}<inlineCode parentName=\"p\">{`LongProcessLogger`}</inlineCode>{` instance.\nonce done, call `}<inlineCode parentName=\"p\">{`end()`}</inlineCode>{`, which logs the duration of the process in ms.`}</p>\n <p>{`Here is an example of the messages produced by this longProcessLogger. The status-line always shows the last message.`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-bash\"\n }}>{`teambit.workspace/workspace, loading components (total: 20)\nteambit.workspace/workspace, loading components (1/20). ui/button\nteambit.workspace/workspace, loading components (2/20). ui/form\n...\nteambit.workspace/workspace, loading components (20/20). ui/page\nteambit.workspace/workspace, loading components (completed in 200ms)\n`}</code></pre>\n <p>{`An example when there is no `}<inlineCode parentName=\"p\">{`totalItems`}</inlineCode>{`.`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-bash\"\n }}>{`teambit.workspace/workspace, loading components\nteambit.workspace/workspace, loading components (completed in 200ms)\n`}</code></pre>\n </MDXLayout>;\n}\n;\nMDXContent.isMDXComponent = true;"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAAmC,IAAAE,SAAA,mBAFnC;AAAA,SAAAH,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,gBAAAA,CAAA;AAAA,SAAAE,SAAA,WAAAA,QAAA,GAAAC,MAAA,CAAAC,MAAA,GAAAD,MAAA,CAAAC,MAAA,CAAAC,IAAA,eAAAC,CAAA,aAAAN,CAAA,MAAAA,CAAA,GAAAO,SAAA,CAAAC,MAAA,EAAAR,CAAA,UAAAS,CAAA,GAAAF,SAAA,CAAAP,CAAA,YAAAU,CAAA,IAAAD,CAAA,OAAAE,cAAA,CAAAC,IAAA,CAAAH,CAAA,EAAAC,CAAA,MAAAJ,CAAA,CAAAI,CAAA,IAAAD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AAU,EAAC;EAAG,+BAA2C,CAAC,cAAY,IAAAhC,OAAA,CAAA8B,GAAA;IAAYE,UAAU,EAAC;EAAG,sBAAkC,CAAC,kCAC1K,IAAAhC,OAAA,CAAA8B,GAAA;IAAYE,UAAU,EAAC;EAAG,UAAsB,CAAC,mDAAsD,CAAC,EACtH,IAAAhC,OAAA,CAAA8B,GAAA,oIAA+H,CAAC,EAChI,IAAA9B,OAAA,CAAA8B,GAAA,eAAK,IAAA9B,OAAA,CAAA8B,GAAA;IAAME,UAAU,EAAC,KAAK;IACvB,WAAW,EAAE;EAAe,mVAO5B,CAAM,CAAC,EACX,IAAAhC,OAAA,CAAA8B,GAAA,6CAAmC,IAAA9B,OAAA,CAAA8B,GAAA;IAAYE,UAAU,EAAC;EAAG,eAA2B,CAAC,KAAQ,CAAC,EAClG,IAAAhC,OAAA,CAAA8B,GAAA,eAAK,IAAA9B,OAAA,CAAA8B,GAAA;IAAME,UAAU,EAAC,KAAK;IACvB,WAAW,EAAE;EAAe,4HAG5B,CAAM,CACC,CAAC;AAChB;AACA;AACAN,UAAU,CAACO,cAAc,GAAG,IAAI","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_react2","_excluded","e","__esModule","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","_objectWithoutProperties","o","i","_objectWithoutPropertiesLoose","getOwnPropertySymbols","s","includes","propertyIsEnumerable","layoutProps","MDXLayout","MDXContent","_ref","components","props","mdx","mdxType","parentName","isMDXComponent"],"sourceRoot":"/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_aspect-docs_logger@0.0.171","sources":["logger.mdx.js"],"sourcesContent":["\n// @ts-nocheck\nimport React from 'react'\nimport { mdx } from '@mdx-js/react'\n\n/* @jsxRuntime classic */\n/* @jsx mdx */\n\n\n\n\nconst layoutProps = {\n \n};\nconst MDXLayout = \"wrapper\"\nexport default function MDXContent({\n components,\n ...props\n}) {\n return <MDXLayout {...layoutProps} {...props} components={components} mdxType=\"MDXLayout\">\n <h2>{`Create a logger`}</h2>\n <p>{`In your extension, add `}<inlineCode parentName=\"p\">{`LoggerMain`}</inlineCode>{` as a dependency and create a new logger by running`}</p>\n <pre><code parentName=\"pre\" {...{}}>{`LoggerMain.createLogger('your-extension-id');\n`}</code></pre>\n <h2>{`Log to a file`}</h2>\n <p>{`The following standard methods are available to log into a file. By default it's the `}<inlineCode parentName=\"p\">{`debug.log`}</inlineCode>{` file located at `}<inlineCode parentName=\"p\">{`~/Library/Caches/Bit/logs`}</inlineCode>{` for Mac/Linux or `}<inlineCode parentName=\"p\">{`%LOCALAPPDATA%\\\\Bit`}</inlineCode>{` for Windows.`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-ts\"\n }}>{`logger.trace(message: string, ...meta: any[]);\nlogger.debug(message: string, ...meta: any[]);\nlogger.info(message: string, ...meta: any[]);\nlogger.warn(message: string, ...meta: any[]);\nlogger.error(message: string, ...meta: any[]);\n`}</code></pre>\n <p>{`The message color is coded uniquely per extension-id. This way, it's easier to scroll the logs and distinguish between the extensions.`}</p>\n <p>{`The format of the message logged to the file is `}<strong parentName=\"p\">{`\"TIMESTAMP LEVEL: EXT-ID, MSG `}{`[META]`}{`\"`}</strong>{`. The \"`}{`[META]`}{`\" part is `}<inlineCode parentName=\"p\">{`JSON.stringify`}</inlineCode>{` of the second parameter in case it's an object. Otherwise, it's ignored.`}</p>\n <p>{`JSON format is available as well. To use it, run `}<inlineCode parentName=\"p\">{`bit config set log_json_format true`}</inlineCode>{`.`}</p>\n <p>{`It's possible to have the console as an extra layer so these messages will be printed to the screen as well, see below.`}</p>\n <h3>{`Log stack trace`}</h3>\n <p>{`Normally, there is no need to log the Error object because it being caught by the end of the process and gets logged by Bit. Sometimes though it is needed to locally catch the error and continue, which can be useful to log the entire error object include the stack trace. In which case, pass the error object as the second parameter. e.g. `}<inlineCode parentName=\"p\">{`catch(err) { logger.error('got an error during component-load', err); }`}</inlineCode></p>\n <h3>{`Log also to the console`}</h3>\n <p>{`To see the same massages above printed into the screen, use the global flag `}<inlineCode parentName=\"p\">{`--log [level]`}</inlineCode>{`. For example, `}<inlineCode parentName=\"p\">{`bit status --log=error`}</inlineCode>{`. If the level was not entered, it defaults to `}<inlineCode parentName=\"p\">{`info`}</inlineCode>{`.`}</p>\n <p>{`Alternatively, you can set an environment variable `}<inlineCode parentName=\"p\">{`BIT_LOG`}</inlineCode>{` with the desired level.`}</p>\n <p>{`The format of the message logged to the console is `}<strong parentName=\"p\">{`\"MSG `}{`[META]`}{`\"`}</strong>{` The \"`}{`[META]`}{`\" part is the same as above.`}</p>\n <h2>{`Report progress`}</h2>\n <p>{`During the command execution it's helpful to see the progress on the screen. The following options log to the file and in addition, print to the screen. Use only these methods and avoid calling `}<inlineCode parentName=\"p\">{`console.log`}</inlineCode>{` to not break the output (or potentially the JSON structure).`}</p>\n <blockquote>\n <p parentName=\"blockquote\">{`Please note that these methods print to the screen only when a command is not considered \"internal\" (such commands normally run on the remote server) and when a command is not used with `}<inlineCode parentName=\"p\">{`--json`}</inlineCode>{` flag. To specifically disable console-printing to a command, set the `}<inlineCode parentName=\"p\">{`loader`}</inlineCode>{` property to `}<inlineCode parentName=\"p\">{`false`}</inlineCode>{`.`}</p>\n </blockquote>\n <h3>{`Status Line (spinner)`}</h3>\n <p>{`The status-line is a single line on the bottom of the screen, with a spinner/loader prefix. It's changing constantly during the command execution. This is the main indicator for the end-user of what's going on at the moment.`}</p>\n <p>{`To set the text of this status-line, call:`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-js\"\n }}>{`logger.setStatusLine((text: string));\n`}</code></pre>\n <p>{`Once the command completed, the spinner is stopped and the status-line is cleared. Then, the command results are printed. If, for some reason, it is needed to clear the status-line before, just call `}<inlineCode parentName=\"p\">{`logger.clearStatusLine()`}</inlineCode>{`.`}</p>\n <h3>{`Persist text`}</h3>\n <p>{`Sometimes it's helpful to indicate that a phase has completed. Either successfully or failed. The following methods help with this:`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-js\"\n }}>{`// print to the screen with a green \\`✔\\` prefix. if message is empty, print the last logged message.\nlogger.consoleSuccess(message?: string);\n\n// print to the screen with a red \\`✖\\` prefix. if message is empty, print the last logged message.\nlogger.consoleFailure(message?: string);\n`}</code></pre>\n <p>{`To print without any prefix, use `}<inlineCode parentName=\"p\">{`logger.console(message);`}</inlineCode></p>\n <h3>{`Long Running Process Logger`}</h3>\n <p>{`Run the following to get an instance of the `}<inlineCode parentName=\"p\">{`LongProcessLogger`}</inlineCode>{` and start logging the process description.`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-js\"\n }}>{`logger.createLongProcessLogger(processDescription: string, totalItems?: number): LongProcessLogger;\n`}</code></pre>\n <p>{`If the process involves iteration over a list of items, such as running tag on a list of components, then pass the `}<inlineCode parentName=\"p\">{`totalItems`}</inlineCode>{` as the total number of the components in the list.`}</p>\n <p>{`Later, during the iteration, call `}<inlineCode parentName=\"p\">{`logProgress(componentName)`}</inlineCode>{` on the `}<inlineCode parentName=\"p\">{`LongProcessLogger`}</inlineCode>{` instance.\nonce done, call `}<inlineCode parentName=\"p\">{`end()`}</inlineCode>{`, which logs the duration of the process in ms.`}</p>\n <p>{`Here is an example of the messages produced by this longProcessLogger. The status-line always shows the last message.`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-bash\"\n }}>{`teambit.workspace/workspace, loading components (total: 20)\nteambit.workspace/workspace, loading components (1/20). ui/button\nteambit.workspace/workspace, loading components (2/20). ui/form\n...\nteambit.workspace/workspace, loading components (20/20). ui/page\nteambit.workspace/workspace, loading components (completed in 200ms)\n`}</code></pre>\n <p>{`An example when there is no `}<inlineCode parentName=\"p\">{`totalItems`}</inlineCode>{`.`}</p>\n <pre><code parentName=\"pre\" {...{\n \"className\": \"language-bash\"\n }}>{`teambit.workspace/workspace, loading components\nteambit.workspace/workspace, loading components (completed in 200ms)\n`}</code></pre>\n </MDXLayout>;\n}\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;AACAN,UAAU,CAACO,cAAc,GAAG,IAAI","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_aspect-docs_logger@0.0.170/dist/logger.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_aspect-docs_logger@0.0.170/dist/logger.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_aspect-docs_logger@0.0.171/dist/logger.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.harmony_aspect-docs_logger@0.0.171/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/harmony.aspect-docs.logger",
3
- "version": "0.0.170",
3
+ "version": "0.0.171",
4
4
  "homepage": "https://bit.cloud/teambit/harmony/aspect-docs/logger",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.harmony",
8
8
  "name": "aspect-docs/logger",
9
- "version": "0.0.170"
9
+ "version": "0.0.171"
10
10
  },
11
11
  "dependencies": {
12
12
  "core-js": "^3.0.0",
@@ -22,7 +22,7 @@
22
22
  "@babel/runtime": "7.20.0",
23
23
  "@types/testing-library__jest-dom": "5.9.5",
24
24
  "@teambit/documenter.theme.theme-compositions": "4.1.1",
25
- "@teambit/mdx.ui.mdx-layout": "1.0.10"
25
+ "@teambit/mdx.ui.mdx-layout": "1.0.11"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": "^16.8.0 || ^17.0.0",