Skip to content

Commit

Permalink
feat: add timing logger
Browse files Browse the repository at this point in the history
  • Loading branch information
KyrieLii committed Nov 29, 2023
1 parent deb4a62 commit a9ea260
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/api/app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export class AppAPI {
type: 'handlebars' | 'ejs' = 'handlebars',
) {
try {
this.generatorCore.logger.timing(`forgeTemplate`);
const { material } = this.generatorContext.current!;
const resourceMap = await material.find(templatePattern, {
nodir: true,
Expand Down Expand Up @@ -205,6 +206,8 @@ export class AppAPI {
this.generatorCore.logger.debug('base forging failed:', e);
this.generatorCore.logger.warn(i18n.t(localeKeys.templated.failed));
throw new Error('base forging failed');
} finally {
this.generatorCore.logger.timing(`forgeTemplate`, true);
}
}

Expand All @@ -215,6 +218,7 @@ export class AppAPI {
parameters?: Record<string, any>,
) {
try {
this.generatorCore.logger.timing(`renderTemplateByFileType`);
const { material } = this.generatorContext.current!;
const resourceMap = await material.find(templatePattern, {
nodir: true,
Expand Down Expand Up @@ -267,6 +271,8 @@ export class AppAPI {
this.generatorCore.logger.debug('base forging failed:', e);
this.generatorCore.logger.warn(i18n.t(localeKeys.templated.failed));
throw new Error('base forging failed');
} finally {
this.generatorCore.logger.timing(`renderTemplateByFileType`, true);
}
}

Expand Down

0 comments on commit a9ea260

Please sign in to comment.