@teambit/logger 0.0.951 → 0.0.953

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,4 +1,4 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <testsuites tests="0" failures="0" errors="0" skipped="0">
3
- <testsuite name="teambit.harmony/logger@0.0.951" tests="0" failures="0" errors="0" skipped="0"/>
3
+ <testsuite name="teambit.harmony/logger@0.0.953" tests="0" failures="0" errors="0" skipped="0"/>
4
4
  </testsuites>
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.harmony/logger-preview"]=t():e["teambit.harmony/logger-preview"]=t()}(self,(()=>(()=>{"use strict";var e={38783:(e,t,n)=>{Object.defineProperty(t,"V",{enumerable:!0,get:function(){return o.default}});var o=r(n(24874));function r(e){return e&&e.__esModule?e:{default:e}}r.__bit_component={id:"teambit.harmony/aspect-docs/logger@0.0.167",homepage:"https://bit.cloud/teambit/harmony/aspect-docs/logger",exported:!0}},24874:(e,t,n)=>{var o={id:"teambit.harmony/aspect-docs/logger@0.0.167",homepage:"https://bit.cloud/teambit/harmony/aspect-docs/logger",exported:!0};Object.defineProperty(t,"__esModule",{value:!0}),t.default=c,s(n(41594));var r=n(5016),a=["components"];function s(e){return e&&e.__esModule?e:{default:e}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},i.apply(this,arguments)}function l(e,t){if(null==e)return{};var n,o,r=m(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function m(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}s.__bit_component=o,i.__bit_component=o,l.__bit_component=o,m.__bit_component=o;var p={},d="wrapper";function c(e){var t=e.components,n=l(e,a);return(0,r.mdx)(d,i({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)("h2",null,"Create a logger"),(0,r.mdx)("p",null,"In your extension, add ",(0,r.mdx)("inlineCode",{parentName:"p"},"LoggerMain")," as a dependency and create a new logger by running"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},"LoggerMain.createLogger('your-extension-id');\n")),(0,r.mdx)("h2",null,"Log to a file"),(0,r.mdx)("p",null,"The following standard methods are available to log into a file. By default it's the ",(0,r.mdx)("inlineCode",{parentName:"p"},"debug.log")," file located at ",(0,r.mdx)("inlineCode",{parentName:"p"},"~/Library/Caches/Bit/logs")," for Mac/Linux or ",(0,r.mdx)("inlineCode",{parentName:"p"},"%LOCALAPPDATA%\\Bit")," for Windows."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-ts"},"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")),(0,r.mdx)("p",null,"The message color is coded uniquely per extension-id. This way, it's easier to scroll the logs and distinguish between the extensions."),(0,r.mdx)("p",null,"The format of the message logged to the file is ",(0,r.mdx)("strong",{parentName:"p"},'"TIMESTAMP LEVEL: EXT-ID, MSG ',"[META]",'"'),'. The "',"[META]",'" part is ',(0,r.mdx)("inlineCode",{parentName:"p"},"JSON.stringify")," of the second parameter in case it's an object. Otherwise, it's ignored."),(0,r.mdx)("p",null,"JSON format is available as well. To use it, run ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit config set log_json_format true"),"."),(0,r.mdx)("p",null,"It's possible to have the console as an extra layer so these messages will be printed to the screen as well, see below."),(0,r.mdx)("h3",null,"Log stack trace"),(0,r.mdx)("p",null,"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. ",(0,r.mdx)("inlineCode",{parentName:"p"},"catch(err) { logger.error('got an error during component-load', err); }")),(0,r.mdx)("h3",null,"Log also to the console"),(0,r.mdx)("p",null,"To see the same massages above printed into the screen, use the global flag ",(0,r.mdx)("inlineCode",{parentName:"p"},"--log [level]"),". For example, ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit status --log=error"),". If the level was not entered, it defaults to ",(0,r.mdx)("inlineCode",{parentName:"p"},"info"),"."),(0,r.mdx)("p",null,"Alternatively, you can set an environment variable ",(0,r.mdx)("inlineCode",{parentName:"p"},"BIT_LOG")," with the desired level."),(0,r.mdx)("p",null,"The format of the message logged to the console is ",(0,r.mdx)("strong",{parentName:"p"},'"MSG ',"[META]",'"'),' The "',"[META]",'" part is the same as above.'),(0,r.mdx)("h2",null,"Report progress"),(0,r.mdx)("p",null,"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 ",(0,r.mdx)("inlineCode",{parentName:"p"},"console.log")," to not break the output (or potentially the JSON structure)."),(0,r.mdx)("blockquote",null,(0,r.mdx)("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 ',(0,r.mdx)("inlineCode",{parentName:"p"},"--json")," flag. To specifically disable console-printing to a command, set the ",(0,r.mdx)("inlineCode",{parentName:"p"},"loader")," property to ",(0,r.mdx)("inlineCode",{parentName:"p"},"false"),".")),(0,r.mdx)("h3",null,"Status Line (spinner)"),(0,r.mdx)("p",null,"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."),(0,r.mdx)("p",null,"To set the text of this status-line, call:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-js"},"logger.setStatusLine((text: string));\n")),(0,r.mdx)("p",null,"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 ",(0,r.mdx)("inlineCode",{parentName:"p"},"logger.clearStatusLine()"),"."),(0,r.mdx)("h3",null,"Persist text"),(0,r.mdx)("p",null,"Sometimes it's helpful to indicate that a phase has completed. Either successfully or failed. The following methods help with this:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-js"},"// 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")),(0,r.mdx)("p",null,"To print without any prefix, use ",(0,r.mdx)("inlineCode",{parentName:"p"},"logger.console(message);")),(0,r.mdx)("h3",null,"Long Running Process Logger"),(0,r.mdx)("p",null,"Run the following to get an instance of the ",(0,r.mdx)("inlineCode",{parentName:"p"},"LongProcessLogger")," and start logging the process description."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-js"},"logger.createLongProcessLogger(processDescription: string, totalItems?: number): LongProcessLogger;\n")),(0,r.mdx)("p",null,"If the process involves iteration over a list of items, such as running tag on a list of components, then pass the ",(0,r.mdx)("inlineCode",{parentName:"p"},"totalItems")," as the total number of the components in the list."),(0,r.mdx)("p",null,"Later, during the iteration, call ",(0,r.mdx)("inlineCode",{parentName:"p"},"logProgress(componentName)")," on the ",(0,r.mdx)("inlineCode",{parentName:"p"},"LongProcessLogger")," instance.\nonce done, call ",(0,r.mdx)("inlineCode",{parentName:"p"},"end()"),", which logs the duration of the process in ms."),(0,r.mdx)("p",null,"Here is an example of the messages produced by this longProcessLogger. The status-line always shows the last message."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"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")),(0,r.mdx)("p",null,"An example when there is no ",(0,r.mdx)("inlineCode",{parentName:"p"},"totalItems"),"."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"teambit.workspace/workspace, loading components\nteambit.workspace/workspace, loading components (completed in 200ms)\n")))}c.__bit_component=o,c.isMDXComponent=!0},63027:(e,t,n)=>{var o={id:"teambit.harmony/logger@0.0.951",homepage:"https://bit.cloud/teambit/harmony/logger",exported:!0};function r(){const e=a(n(41594));return r=function(){return e},e}function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=o,a.__bit_component=o;const s=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/logger.svg"}));s.__bit_component=o,t.Logo=s},5016:e=>{e.exports=MdxJsReact},41594:e=>{e.exports=React}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{compositions:()=>c,compositions_metadata:()=>u,overview:()=>g});var e={};n.r(e),n.d(e,{default:()=>d});var t=n(63027),r=(n(41594),n(5016));const a=TeambitMdxUiMdxScopeContext;var s=n(38783),i=["components"];function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l.apply(this,arguments)}var m={},p="wrapper";function d(e){var t=e.components,n=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,i);return(0,r.mdx)(p,l({},m,n,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(a.MDXScopeProvider,{components:{Logger:s.V},mdxType:"MDXScopeProvider"},(0,r.mdx)(s.V,{mdxType:"Logger"})))}d.isMDXComponent=!0;const c=[t],g=[e],u={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),o})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.harmony/logger-preview"]=t():e["teambit.harmony/logger-preview"]=t()}(self,(()=>(()=>{"use strict";var e={87165:(e,t,n)=>{Object.defineProperty(t,"V",{enumerable:!0,get:function(){return o.default}});var o=r(n(59188));function r(e){return e&&e.__esModule?e:{default:e}}r.__bit_component={id:"teambit.harmony/aspect-docs/logger@0.0.167",homepage:"https://bit.cloud/teambit/harmony/aspect-docs/logger",exported:!0}},59188:(e,t,n)=>{var o={id:"teambit.harmony/aspect-docs/logger@0.0.167",homepage:"https://bit.cloud/teambit/harmony/aspect-docs/logger",exported:!0};Object.defineProperty(t,"__esModule",{value:!0}),t.default=c,s(n(41594));var r=n(5016),a=["components"];function s(e){return e&&e.__esModule?e:{default:e}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},i.apply(this,arguments)}function l(e,t){if(null==e)return{};var n,o,r=m(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function m(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}s.__bit_component=o,i.__bit_component=o,l.__bit_component=o,m.__bit_component=o;var p={},d="wrapper";function c(e){var t=e.components,n=l(e,a);return(0,r.mdx)(d,i({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)("h2",null,"Create a logger"),(0,r.mdx)("p",null,"In your extension, add ",(0,r.mdx)("inlineCode",{parentName:"p"},"LoggerMain")," as a dependency and create a new logger by running"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre"},"LoggerMain.createLogger('your-extension-id');\n")),(0,r.mdx)("h2",null,"Log to a file"),(0,r.mdx)("p",null,"The following standard methods are available to log into a file. By default it's the ",(0,r.mdx)("inlineCode",{parentName:"p"},"debug.log")," file located at ",(0,r.mdx)("inlineCode",{parentName:"p"},"~/Library/Caches/Bit/logs")," for Mac/Linux or ",(0,r.mdx)("inlineCode",{parentName:"p"},"%LOCALAPPDATA%\\Bit")," for Windows."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-ts"},"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")),(0,r.mdx)("p",null,"The message color is coded uniquely per extension-id. This way, it's easier to scroll the logs and distinguish between the extensions."),(0,r.mdx)("p",null,"The format of the message logged to the file is ",(0,r.mdx)("strong",{parentName:"p"},'"TIMESTAMP LEVEL: EXT-ID, MSG ',"[META]",'"'),'. The "',"[META]",'" part is ',(0,r.mdx)("inlineCode",{parentName:"p"},"JSON.stringify")," of the second parameter in case it's an object. Otherwise, it's ignored."),(0,r.mdx)("p",null,"JSON format is available as well. To use it, run ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit config set log_json_format true"),"."),(0,r.mdx)("p",null,"It's possible to have the console as an extra layer so these messages will be printed to the screen as well, see below."),(0,r.mdx)("h3",null,"Log stack trace"),(0,r.mdx)("p",null,"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. ",(0,r.mdx)("inlineCode",{parentName:"p"},"catch(err) { logger.error('got an error during component-load', err); }")),(0,r.mdx)("h3",null,"Log also to the console"),(0,r.mdx)("p",null,"To see the same massages above printed into the screen, use the global flag ",(0,r.mdx)("inlineCode",{parentName:"p"},"--log [level]"),". For example, ",(0,r.mdx)("inlineCode",{parentName:"p"},"bit status --log=error"),". If the level was not entered, it defaults to ",(0,r.mdx)("inlineCode",{parentName:"p"},"info"),"."),(0,r.mdx)("p",null,"Alternatively, you can set an environment variable ",(0,r.mdx)("inlineCode",{parentName:"p"},"BIT_LOG")," with the desired level."),(0,r.mdx)("p",null,"The format of the message logged to the console is ",(0,r.mdx)("strong",{parentName:"p"},'"MSG ',"[META]",'"'),' The "',"[META]",'" part is the same as above.'),(0,r.mdx)("h2",null,"Report progress"),(0,r.mdx)("p",null,"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 ",(0,r.mdx)("inlineCode",{parentName:"p"},"console.log")," to not break the output (or potentially the JSON structure)."),(0,r.mdx)("blockquote",null,(0,r.mdx)("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 ',(0,r.mdx)("inlineCode",{parentName:"p"},"--json")," flag. To specifically disable console-printing to a command, set the ",(0,r.mdx)("inlineCode",{parentName:"p"},"loader")," property to ",(0,r.mdx)("inlineCode",{parentName:"p"},"false"),".")),(0,r.mdx)("h3",null,"Status Line (spinner)"),(0,r.mdx)("p",null,"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."),(0,r.mdx)("p",null,"To set the text of this status-line, call:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-js"},"logger.setStatusLine((text: string));\n")),(0,r.mdx)("p",null,"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 ",(0,r.mdx)("inlineCode",{parentName:"p"},"logger.clearStatusLine()"),"."),(0,r.mdx)("h3",null,"Persist text"),(0,r.mdx)("p",null,"Sometimes it's helpful to indicate that a phase has completed. Either successfully or failed. The following methods help with this:"),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-js"},"// 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")),(0,r.mdx)("p",null,"To print without any prefix, use ",(0,r.mdx)("inlineCode",{parentName:"p"},"logger.console(message);")),(0,r.mdx)("h3",null,"Long Running Process Logger"),(0,r.mdx)("p",null,"Run the following to get an instance of the ",(0,r.mdx)("inlineCode",{parentName:"p"},"LongProcessLogger")," and start logging the process description."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-js"},"logger.createLongProcessLogger(processDescription: string, totalItems?: number): LongProcessLogger;\n")),(0,r.mdx)("p",null,"If the process involves iteration over a list of items, such as running tag on a list of components, then pass the ",(0,r.mdx)("inlineCode",{parentName:"p"},"totalItems")," as the total number of the components in the list."),(0,r.mdx)("p",null,"Later, during the iteration, call ",(0,r.mdx)("inlineCode",{parentName:"p"},"logProgress(componentName)")," on the ",(0,r.mdx)("inlineCode",{parentName:"p"},"LongProcessLogger")," instance.\nonce done, call ",(0,r.mdx)("inlineCode",{parentName:"p"},"end()"),", which logs the duration of the process in ms."),(0,r.mdx)("p",null,"Here is an example of the messages produced by this longProcessLogger. The status-line always shows the last message."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"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")),(0,r.mdx)("p",null,"An example when there is no ",(0,r.mdx)("inlineCode",{parentName:"p"},"totalItems"),"."),(0,r.mdx)("pre",null,(0,r.mdx)("code",{parentName:"pre",className:"language-bash"},"teambit.workspace/workspace, loading components\nteambit.workspace/workspace, loading components (completed in 200ms)\n")))}c.__bit_component=o,c.isMDXComponent=!0},47039:(e,t,n)=>{var o={id:"teambit.harmony/logger@0.0.953",homepage:"https://bit.cloud/teambit/harmony/logger",exported:!0};function r(){const e=a(n(41594));return r=function(){return e},e}function a(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,r.__bit_component=o,a.__bit_component=o;const s=()=>r().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},r().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/logger.svg"}));s.__bit_component=o,t.Logo=s},5016:e=>{e.exports=MdxJsReact},41594:e=>{e.exports=React}},t={};function n(o){var r=t[o];if(void 0!==r)return r.exports;var a=t[o]={exports:{}};return e[o](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{compositions:()=>c,compositions_metadata:()=>u,overview:()=>g});var e={};n.r(e),n.d(e,{default:()=>d});var t=n(47039),r=(n(41594),n(5016));const a=TeambitMdxUiMdxScopeContext;var s=n(87165),i=["components"];function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},l.apply(this,arguments)}var m={},p="wrapper";function d(e){var t=e.components,n=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},a=Object.keys(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,i);return(0,r.mdx)(p,l({},m,n,{components:t,mdxType:"MDXLayout"}),(0,r.mdx)(a.MDXScopeProvider,{components:{Logger:s.V},mdxType:"MDXScopeProvider"},(0,r.mdx)(s.V,{mdxType:"Logger"})))}d.isMDXComponent=!0;const c=[t],g=[e],u={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),o})()));
@@ -640,8 +640,7 @@
640
640
  "line": 54,
641
641
  "character": 21
642
642
  },
643
- "name": "ConsoleOnStart",
644
- "internalFilePath": "long-process-logger.ts"
643
+ "name": "ConsoleOnStart"
645
644
  },
646
645
  "isOptional": true,
647
646
  "isSpread": false
@@ -1442,7 +1441,7 @@
1442
1441
  "_legacy": {
1443
1442
  "scope": "teambit.harmony",
1444
1443
  "name": "logger",
1445
- "version": "0.0.951"
1444
+ "version": "0.0.953"
1446
1445
  },
1447
1446
  "_scope": "teambit.harmony"
1448
1447
  }
@@ -1723,8 +1722,7 @@
1723
1722
  "line": 23,
1724
1723
  "character": 21
1725
1724
  },
1726
- "name": "ConsoleOnStart",
1727
- "internalFilePath": "long-process-logger.ts"
1725
+ "name": "ConsoleOnStart"
1728
1726
  },
1729
1727
  "isOptional": true,
1730
1728
  "isSpread": false
@@ -2530,8 +2528,7 @@
2530
2528
  "line": 54,
2531
2529
  "character": 21
2532
2530
  },
2533
- "name": "ConsoleOnStart",
2534
- "internalFilePath": "long-process-logger.ts"
2531
+ "name": "ConsoleOnStart"
2535
2532
  },
2536
2533
  "isOptional": true,
2537
2534
  "isSpread": false
@@ -3332,7 +3329,7 @@
3332
3329
  "_legacy": {
3333
3330
  "scope": "teambit.harmony",
3334
3331
  "name": "logger",
3335
- "version": "0.0.951"
3332
+ "version": "0.0.953"
3336
3333
  },
3337
3334
  "_scope": "teambit.harmony"
3338
3335
  }
@@ -3551,8 +3548,7 @@
3551
3548
  "line": 23,
3552
3549
  "character": 21
3553
3550
  },
3554
- "name": "ConsoleOnStart",
3555
- "internalFilePath": "long-process-logger.ts"
3551
+ "name": "ConsoleOnStart"
3556
3552
  },
3557
3553
  "isOptional": true,
3558
3554
  "isSpread": false
@@ -3726,7 +3722,7 @@
3726
3722
  "componentId": {
3727
3723
  "scope": "teambit.harmony",
3728
3724
  "name": "logger",
3729
- "version": "0.0.951"
3725
+ "version": "0.0.953"
3730
3726
  },
3731
3727
  "taggedModuleExports": []
3732
3728
  }
package/dist/logger.js CHANGED
@@ -48,7 +48,7 @@ function _longProcessLogger() {
48
48
  }
49
49
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
50
50
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
51
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
51
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
52
52
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
53
53
  class Logger {
54
54
  constructor(extensionName) {
@@ -1 +1 @@
1
- {"version":3,"names":["_dreidels","data","_interopRequireDefault","require","_loader","_logger","_chalk","_os","_longProcessLogger","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","Logger","constructor","extensionName","Spinnies","trace","message","meta","logger","colorMessage","debug","info","warn","error","fatal","isLoaderStarted","loader","isStarted","isSpinning","multiSpinner","spinnies","createLongProcessLogger","processDescription","totalItems","shouldConsole","LongProcessLogger","setStatusLine","text","shouldPrintOnCI","process","env","CI","setTextAndRestart","clearStatusLine","stop","console","shouldWriteToConsole","log","stopAndPersist","consoleWarn","consoleError","consoleTitle","chalk","bold","consoleSuccess","startTime","succeed","off","on","profile","id","consoleFailure","fail","consoleWarning","yellow","isJsonFormat","successSymbol","platform","green","exports"],"sources":["logger.ts"],"sourcesContent":["import Spinnies from 'dreidels';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport logger, { IBitLogger } from '@teambit/legacy/dist/logger/logger';\nimport chalk from 'chalk';\nimport { platform } from 'os';\nimport { ConsoleOnStart, LongProcessLogger } from './long-process-logger';\n\nexport class Logger implements IBitLogger {\n spinnies = new Spinnies();\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 get isSpinning() {\n return loader.isSpinning;\n }\n\n get multiSpinner() {\n return this.spinnies;\n }\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(\n processDescription: string,\n totalItems?: number,\n shouldConsole?: ConsoleOnStart\n ): LongProcessLogger {\n return new LongProcessLogger(this, this.extensionName, processDescription, totalItems, shouldConsole);\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, shouldPrintOnCI = false) {\n if (process.env.CI && !shouldPrintOnCI) return;\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 /**\n * @deprecated\n * try using consoleWarning. if not possible, rename this method to a clearer one\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 /**\n * @deprecated\n * try using consoleFailure. if not possible, rename this method to a clearer one\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, startTime?: [number, number]) {\n if (message) this.info(message);\n loader.succeed(message, startTime);\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 /**\n * a recent change on Windows caused the check mark to be printed as purple.\n * see https://github.com/chalk/chalk/issues/625\n */\n static successSymbol() {\n return platform() === 'win32' ? chalk.green('✓') : chalk.green('✔');\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,OAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,MAAA,YAAAA,CAAA;IA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;IAChCU,iBAAM,CAACoC,IAAI,CAAC9C,OAAO,CAAC;EACtB;EACA;AACF;AACA;EACE+C,cAAcA,CAAC/C,OAAgB,EAAE;IAC/B,IAAIA,OAAO,EAAE;MACX,IAAI,CAACM,IAAI,CAACN,OAAO,CAAC;MAClBA,OAAO,GAAGoC,gBAAK,CAACY,MAAM,CAAChD,OAAO,CAAC;IACjC;IACAU,iBAAM,CAACJ,IAAI,CAACN,OAAO,CAAC;EACtB;EAEQG,YAAYA,CAACH,OAAe,EAAE;IACpC,IAAIE,iBAAM,CAAC+C,YAAY,EAAE,OAAQ,GAAE,IAAI,CAACpD,aAAc,KAAIG,OAAQ,EAAC;IACnE,OAAQ,GAAEoC,gBAAK,CAACC,IAAI,CAAC,IAAI,CAACxC,aAAa,CAAE,KAAIG,OAAQ,EAAC;EACxD;;EAEA;AACF;AACA;AACA;EACE,OAAOkD,aAAaA,CAAA,EAAG;IACrB,OAAO,IAAAC,cAAQ,EAAC,CAAC,KAAK,OAAO,GAAGf,gBAAK,CAACgB,KAAK,CAAC,GAAG,CAAC,GAAGhB,gBAAK,CAACgB,KAAK,CAAC,GAAG,CAAC;EACrE;AACF;AAACC,OAAA,CAAA1D,MAAA,GAAAA,MAAA","ignoreList":[]}
1
+ {"version":3,"names":["_dreidels","data","_interopRequireDefault","require","_loader","_logger","_chalk","_os","_longProcessLogger","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","Logger","constructor","extensionName","Spinnies","trace","message","meta","logger","colorMessage","debug","info","warn","error","fatal","isLoaderStarted","loader","isStarted","isSpinning","multiSpinner","spinnies","createLongProcessLogger","processDescription","totalItems","shouldConsole","LongProcessLogger","setStatusLine","text","shouldPrintOnCI","process","env","CI","setTextAndRestart","clearStatusLine","stop","console","shouldWriteToConsole","log","stopAndPersist","consoleWarn","consoleError","consoleTitle","chalk","bold","consoleSuccess","startTime","succeed","off","on","profile","id","consoleFailure","fail","consoleWarning","yellow","isJsonFormat","successSymbol","platform","green","exports"],"sources":["logger.ts"],"sourcesContent":["import Spinnies from 'dreidels';\nimport loader from '@teambit/legacy/dist/cli/loader';\nimport logger, { IBitLogger } from '@teambit/legacy/dist/logger/logger';\nimport chalk from 'chalk';\nimport { platform } from 'os';\nimport { ConsoleOnStart, LongProcessLogger } from './long-process-logger';\n\nexport class Logger implements IBitLogger {\n spinnies = new Spinnies();\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 get isSpinning() {\n return loader.isSpinning;\n }\n\n get multiSpinner() {\n return this.spinnies;\n }\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(\n processDescription: string,\n totalItems?: number,\n shouldConsole?: ConsoleOnStart\n ): LongProcessLogger {\n return new LongProcessLogger(this, this.extensionName, processDescription, totalItems, shouldConsole);\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, shouldPrintOnCI = false) {\n if (process.env.CI && !shouldPrintOnCI) return;\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 /**\n * @deprecated\n * try using consoleWarning. if not possible, rename this method to a clearer one\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 /**\n * @deprecated\n * try using consoleFailure. if not possible, rename this method to a clearer one\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, startTime?: [number, number]) {\n if (message) this.info(message);\n loader.succeed(message, startTime);\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 /**\n * a recent change on Windows caused the check mark to be printed as purple.\n * see https://github.com/chalk/chalk/issues/625\n */\n static successSymbol() {\n return platform() === 'win32' ? chalk.green('✓') : chalk.green('✔');\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,QAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,OAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,MAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,IAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,GAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,mBAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,kBAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0E,SAAAC,uBAAAO,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,G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C,cAAQ,EAAC,CAAC,KAAK,OAAO,GAAGf,gBAAK,CAACgB,KAAK,CAAC,GAAG,CAAC,GAAGhB,gBAAK,CAACgB,KAAK,CAAC,GAAG,CAAC;EACrE;AACF;AAACC,OAAA,CAAA1D,MAAA,GAAAA,MAAA","ignoreList":[]}
@@ -26,7 +26,7 @@ function _logger2() {
26
26
  return data;
27
27
  }
28
28
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
29
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
29
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
30
30
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
31
31
  class LoggerMain {
32
32
  createLogger(extensionName) {
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","_logger","_logger2","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","LoggerMain","createLogger","extensionName","Logger","provider","exports","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,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,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AC;EACzB;AACF;AAACK,OAAA,CAAAL,UAAA,GAAAA,UAAA;AAAArB,eAAA,CAXYqB,UAAU,aACJM,kBAAW;AAAA3B,eAAA,CADjBqB,UAAU,kBAEC,EAAE;AAW1BO,uBAAY,CAACC,UAAU,CAACR,UAAU,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_cli","data","require","_logger","_logger2","_defineProperty","obj","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","LoggerMain","createLogger","extensionName","Logger","provider","exports","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,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAE,QAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,OAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA+C,SAAAI,gBAAAC,GAAA,EAAAC,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAD,GAAA,IAAAI,MAAA,CAAAC,cAAA,CAAAL,GAAA,EAAAC,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAR,GAAA,CAAAC,GAAA,IAAAC,KAAA,WAAAF,GAAA;AAAA,SAAAG,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAF,CAAA,EAAAG,CAAA,2BAAAH,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAI,CAAA,GAAAJ,CAAA,CAAAK,MAAA,CAAAC,WAAA,kBAAAF,CAAA,QAAAH,CAAA,GAAAG,CAAA,CAAAG,IAAA,CAAAP,CAAA,EAAAG,CAAA,uCAAAF,CAAA,SAAAA,CAAA,YAAAO,SAAA,yEAAAL,CAAA,GAAAM,MAAA,GAAAC,MAAA,EAAAV,CAAA;AAExC,MAAMW,UAAU,CAAC;EAItBC,YAAYA,CAACC,aAAqB,EAAU;IAC1C,OAAO,KAAIC,gBAAM,EAACD,aAAa,CAAC;EAClC;EAEA,aAAaE,QAAQA,CAAA,EAAG;IACtB,OAAO,IAAIJ,UAAU,CAAC,CAAC;EACzB;AACF;AAACK,OAAA,CAAAL,UAAA,GAAAA,UAAA;AAAArB,eAAA,CAXYqB,UAAU,aACJM,kBAAW;AAAA3B,eAAA,CADjBqB,UAAU,kBAEC,EAAE;AAW1BO,uBAAY,CAACC,UAAU,CAACR,UAAU,CAAC","ignoreList":[]}
@@ -13,7 +13,7 @@ function _prettyTime() {
13
13
  }
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
17
17
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
18
  /**
19
19
  * use it for a long running process. upon creation it logs the `processDescription`.
@@ -1 +1 @@
1
- {"version":3,"names":["_prettyTime","data","_interopRequireDefault","require","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","String","r","e","Symbol","toPrimitive","call","TypeError","Number","LongProcessLogger","constructor","logPublisher","extensionName","processDescription","totalItems","shouldConsole","process","hrtime","start","logProgress","itemName","showProcessDescription","currentItem","processDesc","message","getProgress","debug","setStatusLine","end","env","CI","description","duration","startTime","completedOrFailedStr","prettyTime","info","consoleSuccess","consoleFailure","totalItemsStr","consoleTitle","console","exports"],"sources":["long-process-logger.ts"],"sourcesContent":["import prettyTime from 'pretty-time';\nimport type { Logger } from './logger';\n\nexport type ConsoleOnStart = 'normal' | 'title';\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 private currentItem = 0;\n private startTime = process.hrtime();\n constructor(\n private logPublisher: Logger,\n private extensionName: string,\n private processDescription: string,\n private totalItems?: number,\n shouldConsole?: ConsoleOnStart\n ) {\n this.start(shouldConsole);\n }\n\n logProgress(itemName = '', showProcessDescription = true) {\n this.currentItem += 1;\n const processDesc = showProcessDescription ? `${this.processDescription} ` : '';\n const message = `${processDesc}${this.getProgress()} ${itemName}`;\n this.logPublisher.debug(message);\n this.logPublisher.setStatusLine(message, true);\n }\n\n end(shouldConsole?: 'success' | 'error') {\n if (process.env.CI && !shouldConsole) shouldConsole = 'success';\n const description = this.processDescription;\n const duration = process.hrtime(this.startTime);\n const completedOrFailedStr = !shouldConsole || shouldConsole === 'success' ? 'Succeeded' : 'Failed';\n const message = `${description}. ${completedOrFailedStr} in ${prettyTime(duration)}`;\n this.logPublisher.info(message);\n if (shouldConsole) {\n if (shouldConsole === 'success') this.logPublisher.consoleSuccess(message);\n else this.logPublisher.consoleFailure(message);\n } else this.logPublisher.setStatusLine(message);\n }\n\n getProgress() {\n return `(${this.currentItem}/${this.totalItems})`;\n }\n\n private start(shouldConsole?: ConsoleOnStart) {\n if (process.env.CI && !shouldConsole) shouldConsole = 'normal';\n const totalItemsStr = this.totalItems ? `(total: ${this.totalItems})` : '';\n const message = `${this.processDescription} ${totalItemsStr}`;\n this.logPublisher.info(message);\n if (shouldConsole) {\n if (shouldConsole === 'title') this.logPublisher.consoleTitle(message);\n else this.logPublisher.console(message);\n } else this.logPublisher.setStatusLine(message);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAqC,SAAAC,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAX,GAAA,CAAAI,GAAA,IAAAC,KAAA,WAAAL,GAAA;AAAA,SAAAM,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA,CAAAF,CAAA,uCAAAC,CAAA,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AK,OAAO,EAAE,IAAI,CAACJ,YAAY,CAAC6B,YAAY,CAAChB,OAAO,CAAC,CAAC,KAClE,IAAI,CAACb,YAAY,CAAC8B,OAAO,CAACjB,OAAO,CAAC;IACzC,CAAC,MAAM,IAAI,CAACb,YAAY,CAACgB,aAAa,CAACH,OAAO,CAAC;EACjD;AACF;AAACkB,OAAA,CAAAjC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_prettyTime","data","_interopRequireDefault","require","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","t","i","_toPrimitive","r","e","Symbol","toPrimitive","call","TypeError","String","Number","LongProcessLogger","constructor","logPublisher","extensionName","processDescription","totalItems","shouldConsole","process","hrtime","start","logProgress","itemName","showProcessDescription","currentItem","processDesc","message","getProgress","debug","setStatusLine","end","env","CI","description","duration","startTime","completedOrFailedStr","prettyTime","info","consoleSuccess","consoleFailure","totalItemsStr","consoleTitle","console","exports"],"sources":["long-process-logger.ts"],"sourcesContent":["import prettyTime from 'pretty-time';\nimport type { Logger } from './logger';\n\nexport type ConsoleOnStart = 'normal' | 'title';\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 private currentItem = 0;\n private startTime = process.hrtime();\n constructor(\n private logPublisher: Logger,\n private extensionName: string,\n private processDescription: string,\n private totalItems?: number,\n shouldConsole?: ConsoleOnStart\n ) {\n this.start(shouldConsole);\n }\n\n logProgress(itemName = '', showProcessDescription = true) {\n this.currentItem += 1;\n const processDesc = showProcessDescription ? `${this.processDescription} ` : '';\n const message = `${processDesc}${this.getProgress()} ${itemName}`;\n this.logPublisher.debug(message);\n this.logPublisher.setStatusLine(message, true);\n }\n\n end(shouldConsole?: 'success' | 'error') {\n if (process.env.CI && !shouldConsole) shouldConsole = 'success';\n const description = this.processDescription;\n const duration = process.hrtime(this.startTime);\n const completedOrFailedStr = !shouldConsole || shouldConsole === 'success' ? 'Succeeded' : 'Failed';\n const message = `${description}. ${completedOrFailedStr} in ${prettyTime(duration)}`;\n this.logPublisher.info(message);\n if (shouldConsole) {\n if (shouldConsole === 'success') this.logPublisher.consoleSuccess(message);\n else this.logPublisher.consoleFailure(message);\n } else this.logPublisher.setStatusLine(message);\n }\n\n getProgress() {\n return `(${this.currentItem}/${this.totalItems})`;\n }\n\n private start(shouldConsole?: ConsoleOnStart) {\n if (process.env.CI && !shouldConsole) shouldConsole = 'normal';\n const totalItemsStr = this.totalItems ? `(total: ${this.totalItems})` : '';\n const message = `${this.processDescription} ${totalItemsStr}`;\n this.logPublisher.info(message);\n if (shouldConsole) {\n if (shouldConsole === 'title') this.logPublisher.consoleTitle(message);\n else this.logPublisher.console(message);\n } else this.logPublisher.setStatusLine(message);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAqC,SAAAC,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,gBAAAH,GAAA,EAAAI,GAAA,EAAAC,KAAA,IAAAD,GAAA,GAAAE,cAAA,CAAAF,GAAA,OAAAA,GAAA,IAAAJ,GAAA,IAAAO,MAAA,CAAAC,cAAA,CAAAR,GAAA,EAAAI,GAAA,IAAAC,KAAA,EAAAA,KAAA,EAAAI,UAAA,QAAAC,YAAA,QAAAC,QAAA,oBAAAX,GAAA,CAAAI,GAAA,IAAAC,KAAA,WAAAL,GAAA;AAAA,SAAAM,eAAAM,CAAA,QAAAC,CAAA,GAAAC,YAAA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AIA,aAAa,KAAK,OAAO,EAAE,IAAI,CAACJ,YAAY,CAAC6B,YAAY,CAAChB,OAAO,CAAC,CAAC,KAClE,IAAI,CAACb,YAAY,CAAC8B,OAAO,CAACjB,OAAO,CAAC;IACzC,CAAC,MAAM,IAAI,CAACb,YAAY,CAACgB,aAAa,CAACH,OAAO,CAAC;EACjD;AACF;AAACkB,OAAA,CAAAjC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_logger@0.0.951/dist/logger.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_logger@0.0.951/dist/logger.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_logger@0.0.953/dist/logger.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_logger@0.0.953/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,24 +1,24 @@
1
1
  {
2
2
  "name": "@teambit/logger",
3
- "version": "0.0.951",
3
+ "version": "0.0.953",
4
4
  "homepage": "https://bit.cloud/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.951"
9
+ "version": "0.0.953"
10
10
  },
11
11
  "dependencies": {
12
12
  "chalk": "2.4.2",
13
13
  "dreidels": "0.6.1",
14
14
  "pretty-time": "1.1.0",
15
15
  "@teambit/harmony": "0.4.6",
16
- "@teambit/cli": "0.0.858"
16
+ "@teambit/cli": "0.0.860"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@types/mocha": "9.1.0",
20
20
  "chai": "4.3.0",
21
- "@teambit/harmony.envs.core-aspect-env": "0.0.27",
21
+ "@teambit/harmony.envs.core-aspect-env": "0.0.30",
22
22
  "@teambit/harmony.aspect-docs.logger": "0.0.167"
23
23
  },
24
24
  "peerDependencies": {
package/tsconfig.json CHANGED
@@ -20,7 +20,8 @@
20
20
  "emitDeclarationOnly": true,
21
21
  "strict": true,
22
22
  "strictPropertyInitialization": false,
23
- "noImplicitAny": false
23
+ "noImplicitAny": false,
24
+ "composite": true
24
25
  },
25
26
  "exclude": [
26
27
  "artifacts",
@@ -35,5 +36,10 @@
35
36
  "include": [
36
37
  "**/*",
37
38
  "**/*.json"
39
+ ],
40
+ "references": [
41
+ {
42
+ "path": "/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_cli@0.0.860"
43
+ }
38
44
  ]
39
45
  }
package/dist/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export { Logger } from './logger';
2
- export type { LoggerMain } from './logger.main.runtime';
3
- export { LoggerAspect } from './logger.aspect';
4
- export { LongProcessLogger } from './long-process-logger';
@@ -1,2 +0,0 @@
1
- import { Aspect } from '@teambit/harmony';
2
- export declare const LoggerAspect: Aspect;
@@ -1 +0,0 @@
1
- export declare const Logo: () => import("react/jsx-runtime").JSX.Element;
package/dist/logger.d.ts DELETED
@@ -1,77 +0,0 @@
1
- import Spinnies from 'dreidels';
2
- import { IBitLogger } from '@teambit/legacy/dist/logger/logger';
3
- import { ConsoleOnStart, LongProcessLogger } from './long-process-logger';
4
- export declare class Logger implements IBitLogger {
5
- private extensionName;
6
- spinnies: Spinnies;
7
- constructor(extensionName: string);
8
- trace(message: string, ...meta: any[]): void;
9
- debug(message: string, ...meta: any[]): void;
10
- info(message: string, ...meta: any[]): void;
11
- warn(message: string, ...meta: any[]): void;
12
- error(message: string, ...meta: any[]): void;
13
- fatal(message: string, ...meta: any[]): void;
14
- get isLoaderStarted(): boolean;
15
- get isSpinning(): boolean | undefined;
16
- get multiSpinner(): Spinnies;
17
- /**
18
- * use it for a long running process. upon creation it logs the `processDescription`.
19
- * if the process involves iteration over a list of items, such as running tag on a list of
20
- * components, then pass the `totalItems` as the total of the total components in the list.
21
- * later, during the iteration, call `LongProcessLogger.logProgress(componentName)`.
22
- * once done, call `LongProcessLogger.end()`
23
- * the status-line will show all messages in the terminal.
24
- */
25
- createLongProcessLogger(processDescription: string, totalItems?: number, shouldConsole?: ConsoleOnStart): LongProcessLogger;
26
- /**
27
- * single status-line on the bottom of the screen.
28
- * the text is replaced every time this method is called.
29
- */
30
- setStatusLine(text: string, shouldPrintOnCI?: boolean): void;
31
- /**
32
- * remove the text from the last line on the screen.
33
- */
34
- clearStatusLine(): void;
35
- /**
36
- * print to the screen. if message is empty, print the last logged message.
37
- */
38
- console(message?: string, ...meta: any[]): void;
39
- /**
40
- * @deprecated
41
- * try using consoleWarning. if not possible, rename this method to a clearer one
42
- */
43
- consoleWarn(message?: string, ...meta: any[]): void;
44
- /**
45
- * @deprecated
46
- * try using consoleFailure. if not possible, rename this method to a clearer one
47
- */
48
- consoleError(message?: string, ...meta: any[]): void;
49
- /**
50
- * print to the screen as a title, with bold text.
51
- */
52
- consoleTitle(message: string): void;
53
- /**
54
- * print to the screen with a green `✔` prefix. if message is empty, print the last logged message.
55
- */
56
- consoleSuccess(message?: string, startTime?: [number, number]): void;
57
- /**
58
- * turn off the logger.
59
- */
60
- off(): import("@teambit/legacy/dist/cli/loader/loader").Loader;
61
- on(): import("@teambit/legacy/dist/cli/loader/loader").Loader;
62
- profile(id: string, console?: boolean): void;
63
- /**
64
- * print to the screen with a red `✖` prefix. if message is empty, print the last logged message.
65
- */
66
- consoleFailure(message?: string): void;
67
- /**
68
- * print to the screen with a red `⚠` prefix. if message is empty, print the last logged message.
69
- */
70
- consoleWarning(message?: string): void;
71
- private colorMessage;
72
- /**
73
- * a recent change on Windows caused the check mark to be printed as purple.
74
- * see https://github.com/chalk/chalk/issues/625
75
- */
76
- static successSymbol(): string;
77
- }
@@ -1,7 +0,0 @@
1
- import { Logger } from './logger';
2
- export declare class LoggerMain {
3
- static runtime: import("@teambit/harmony").RuntimeDefinition;
4
- static dependencies: never[];
5
- createLogger(extensionName: string): Logger;
6
- static provider(): Promise<LoggerMain>;
7
- }
@@ -1,24 +0,0 @@
1
- import type { Logger } from './logger';
2
- export type ConsoleOnStart = 'normal' | 'title';
3
- /**
4
- * use it for a long running process. upon creation it logs the `processDescription`.
5
- * if the process involves iteration over a list of items, such as running tag on a list of
6
- * components, then pass the `totalItems` as the total components in the list.
7
- * later, during the iteration, call `logProgress(componentName)`.
8
- * once done, call `end()`.
9
- * the status-line will show all messages in the terminal.
10
- * see README for more data.
11
- */
12
- export declare class LongProcessLogger {
13
- private logPublisher;
14
- private extensionName;
15
- private processDescription;
16
- private totalItems?;
17
- private currentItem;
18
- private startTime;
19
- constructor(logPublisher: Logger, extensionName: string, processDescription: string, totalItems?: number | undefined, shouldConsole?: ConsoleOnStart);
20
- logProgress(itemName?: string, showProcessDescription?: boolean): void;
21
- end(shouldConsole?: 'success' | 'error'): void;
22
- getProgress(): string;
23
- private start;
24
- }