Skip to content

Commit

Permalink
some tweaks to the logging
Browse files Browse the repository at this point in the history
  • Loading branch information
horatiorosa committed Dec 27, 2024
1 parent ec1b5b3 commit d7070da
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
5 changes: 3 additions & 2 deletions client/app/components/projects/new.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ export default class ProjectsNewFormComponent extends Component {
@action
async submitProject() {
const requestStartTime = Date.now();
console.log(`[Total Requests Made in the service] ${this.requestCounter}`);
this.requestCounter++;
console.log(`LOGGER: [Total Requests Made in the client controller] ${this.requestCounter}`);

const primaryContactInput = {
first: this.args.package.primaryContactFirstName,
Expand Down Expand Up @@ -121,7 +122,7 @@ export default class ProjectsNewFormComponent extends Component {
});
const { data: project } = await response.json();
const requestEndTime = Date.now();
console.debug(`POST request in the service to took ${requestEndTime - requestStartTime} ms`);
console.debug(`LOGGER: POST request in the client controller to took ${requestEndTime - requestStartTime} ms`);
console.debug('response in client controller: ', response, 'response status: ', response.status);

this.args.package.saveAttachedFiles(project.attributes['dcp-artifactsid']);
Expand Down
5 changes: 3 additions & 2 deletions server/src/projects/projects.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ export class ProjectsController {
@Post('/')
async createProject(@Body() body) {
const requestStartTime = Date.now();
console.log(`[Total Requests Made in the controller] ${this.requestCounter}`)
const allowedAttrs = pick(body, PROJECT_ATTRS) as {
dcp_projectname: string;
dcp_borough: string;
Expand All @@ -153,7 +152,9 @@ export class ProjectsController {
);
}
const requestEndTime = Date.now();
console.debug(`POST request in the controller to took ${requestEndTime - requestStartTime} ms`);
this.requestCounter++;
console.log(`LOGGER: [Total Requests Made in the controller] ${this.requestCounter}`)
console.debug(`LOGGER: POST request in the controller to took ${requestEndTime - requestStartTime} ms`);

return await this.projectsService.create(allowedAttrs);
}
Expand Down
13 changes: 6 additions & 7 deletions server/src/projects/projects.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ export class ProjectsService {
}) {
try {
const requestStartTime = Date.now();
console.log(`[Total Requests Made in the service] ${requestCounter}`);

requestCounter++;

const data = {
dcp_projectname: attributes.dcp_projectname,
Expand All @@ -134,8 +132,7 @@ export class ProjectsService {
'dcp_projects',
data,
);
console.debug("project", project);
console.debug("project response", project.response);
console.debug("LOGGER: (service) project", project);
const { dcp_projectid } = project;

// const { dcp_artifactsid } =
Expand All @@ -147,16 +144,18 @@ export class ProjectsService {
await this.artifactService.createProjectInitiationArtifacts(
dcp_projectid,
);
console.debug('artifact', artifact);
console.debug('LOGGER: (service) artifact', artifact);
const { dcp_artifactsid } = artifact;
const requestEndTime = Date.now();
console.debug(`POST request in the service to took ${requestEndTime - requestStartTime} ms`);
console.debug(`LOGGER: POST (service) request in the service to took ${requestEndTime - requestStartTime} ms`);
requestCounter++;
console.log(`LOGGER: [Total Requests Made in the service] ${requestCounter}`);
return {
dcp_projectid,
dcp_artifactsid,
};
} catch (e) {
console.debug('error creating project', e);
console.debug('(service) error creating project', e);
throw new HttpException(
'Unable to create project',
HttpStatus.INTERNAL_SERVER_ERROR,
Expand Down

0 comments on commit d7070da

Please sign in to comment.