-
Notifications
You must be signed in to change notification settings - Fork 142
Add verbose logging (-v option) functionality
#2860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
6b50d4a
fc9b865
fbad7d0
b0851ac
82d5952
6f3a23c
c2f011c
4d0c4c8
ca42f53
a90732f
ac7fdcc
b170d13
cd37cf4
8cce038
89f2a0d
3f3d1b8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -518,7 +518,6 @@ export class Page { | |
| */ | ||
| async generate(externalManager: ExternalManager) { | ||
| this.resetState(); // Reset for live reload | ||
|
|
||
| const fileConfig: NodeProcessorConfig = { | ||
| baseUrl: this.siteConfig.baseUrl, | ||
| ignore: this.siteConfig.ignore, | ||
|
|
@@ -594,6 +593,7 @@ export class Page { | |
| * However, for automated testings (e.g. snapshots), we will output the pre SSR-processed HTML content | ||
| * as we want to retain the unrendered DOM for easier reference and checking. | ||
| */ | ||
| logger.verbose(`Rendering page: ${this.pageConfig.sourcePath}`); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this the only instance where we are using verbose logging?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeap, for now it is the only use of verbose logging |
||
| const vueSsrHtml = await pageVueServerRenderer.renderVuePage(renderFn); | ||
| this.filterIconAssets(content, vueSsrHtml); | ||
| if (process.env.TEST_MODE) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,48 +28,28 @@ winston.configure({ | |
| transports: [consoleTransport], | ||
| }); | ||
|
|
||
| // create a wrapper for error messages | ||
| const errorWrap = (input: any) => { | ||
| const createLoggerThatInterruptsProgressBar = (level: string) => (...args: any[]) => { | ||
| if (progressBar) { | ||
| progressBar.interruptBegin(); | ||
| winston.error(input); | ||
| (winston as any).log(level, ...args); | ||
| progressBar.interruptEnd(); | ||
| } else { | ||
| winston.error(input); | ||
| (winston as any).log(level, ...args); | ||
| } | ||
| }; | ||
|
|
||
| // create a wrapper for warning messages | ||
| const warnWrap = (input: any) => { | ||
| if (progressBar) { | ||
| progressBar.interruptBegin(); | ||
| winston.warn(input); | ||
| progressBar.interruptEnd(); | ||
| } else { | ||
| winston.warn(input); | ||
| } | ||
| }; | ||
|
|
||
| // create a wrapper for info messages | ||
| const infoWrap = (input: any) => { | ||
| if (progressBar) { | ||
| progressBar.interruptBegin(); | ||
| winston.info(input); | ||
| progressBar.interruptEnd(); | ||
| } else { | ||
| winston.info(input); | ||
| } | ||
| }; | ||
|
|
||
| const { debug } = winston; | ||
| const { verbose } = winston; | ||
| const errorWrap = createLoggerThatInterruptsProgressBar('error'); | ||
| const warnWrap = createLoggerThatInterruptsProgressBar('warn'); | ||
| const infoWrap = createLoggerThatInterruptsProgressBar('info'); | ||
| const verboseWrap = createLoggerThatInterruptsProgressBar('verbose'); | ||
| const debugWrap = createLoggerThatInterruptsProgressBar('debug'); | ||
|
Comment on lines
+31
to
+45
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice abstraction |
||
|
|
||
| export { | ||
| errorWrap as error, | ||
| warnWrap as warn, | ||
| infoWrap as info, | ||
| verbose, | ||
| debug, | ||
| verboseWrap as verbose, | ||
| debugWrap as debug, | ||
| setProgressBar, | ||
| removeProgressBar, | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
had some concerns with using consoleTransport as a module level global variable but ig it's fine for our use case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think so