Skip to content

Commit

Permalink
Replace console.log with custom logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicola Lanzilotto committed Oct 6, 2023
1 parent c36eec5 commit 6e14930
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/app/components/navbar/navbar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ export class NavbarComponent implements OnInit, AfterViewInit, AfterContentCheck
this.router.events
.subscribe((event: NavigationEvent) => {
if (event instanceof NavigationEnd) {
console.log('[NAVBAR] NavigationEnd ', event.url);
// console.log('[NAVBAR] NavigationEnd ', event.url);

/** HIDE THE PLAN NAME IF THE ROUTE ACTIVE IS THE HOME */
if (event.url.indexOf('/home') !== -1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class InstallTemplateComponent extends WidgetSetUpBaseComponent implement
getParamsTemplatesAndProjects() {
this.route.params.subscribe((params) => {

console.log('[INSTALL-TEMPLATE] params ', params)
// console.log('[INSTALL-TEMPLATE] params ', params)
this.projectId = params.projectid;
// this.logger.log('[INSTALL-TEMPLATE] projectId ', this.projectId)
this.botId = params.botid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ export class HomeWhatsappAccountComponent implements OnInit, OnChanges {
* On changes
*/
ngOnChanges(changes: SimpleChanges) {
console.log('[HOME-WA] ngOnChanges changes ', changes);
console.log('[HOME-WA] ngOnChanges whatsAppIsInstalled ', this.whatsAppIsInstalled);
console.log('[HOME-WA] ngOnChanges whatsAppIsConnected ', this.whatsAppIsConnected);
console.log('[HOME-WA] ngOnChanges solution_channel_for_child ', this.solution_channel_for_child);
console.log('[HOME-WA] ngOnChanges solution_for_child ', this.solution_for_child);
console.log('[HOME-WA] userHasClickedDisplayWAWizard ', this.userHasClickedDisplayWAWizard)
this.logger.log('[HOME-WA] ngOnChanges changes ', changes);
this.logger.log('[HOME-WA] ngOnChanges whatsAppIsInstalled ', this.whatsAppIsInstalled);
this.logger.log('[HOME-WA] ngOnChanges whatsAppIsConnected ', this.whatsAppIsConnected);
this.logger.log('[HOME-WA] ngOnChanges solution_channel_for_child ', this.solution_channel_for_child);
this.logger.log('[HOME-WA] ngOnChanges solution_for_child ', this.solution_for_child);
this.logger.log('[HOME-WA] userHasClickedDisplayWAWizard ', this.userHasClickedDisplayWAWizard)
// this.getApps();
}

Expand Down
42 changes: 21 additions & 21 deletions src/app/home/home.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
takeUntil(this.unsubscribe$)
)
.subscribe((project) => {
console.log('[HOME] $UBSCIBE TO PUBLISHED PROJECT - RES --> ', project)
this.logger.log('[HOME] $UBSCIBE TO PUBLISHED PROJECT - RES --> ', project)

if (project) {
this.project = project
Expand All @@ -316,7 +316,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {

getProjectById(projectId) {
this.projectService.getProjectById(projectId).subscribe((project: any) => {
console.log('[HOME] - GET PROJECT BY ID - PROJECT: ', project);
this.logger.log('[HOME] - GET PROJECT BY ID - PROJECT: ', project);

if (project && project.attributes && project.attributes.userPreferences) {
this.PROJECT_ATTRIBUTES = project.attributes;
Expand Down Expand Up @@ -630,8 +630,8 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
this.logger.log('[HOME] - trackUserAction ', event);
const userAction = event.action
const userActionRes = event.actionRes
console.log('[HOME] - trackUserAction userAction', userAction);
console.log('[HOME] - trackUserAction userActionRes', userActionRes);
this.logger.log('[HOME] - trackUserAction userAction', userAction);
this.logger.log('[HOME] - trackUserAction userActionRes', userActionRes);
const trackObjct = {
"type": "organic",
"username": userFullname,
Expand Down Expand Up @@ -667,7 +667,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
trackObjct['category'] = userActionRes
}

console.log('[HOME] - trackUserAction trackObjct', trackObjct);
this.logger.log('[HOME] - trackUserAction trackObjct', trackObjct);
if (!isDevMode()) {
try {
window['analytics'].track(userAction, trackObjct);
Expand Down Expand Up @@ -1237,7 +1237,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
getApps() {
this.appStoreService.getApps().subscribe((_apps: any) => {
this.apps = _apps.apps;
console.log('[HOME] - getApps APPS ', this.apps);
this.logger.log('[HOME] - getApps APPS ', this.apps);
this.apps.forEach(app => {
if (app.title === "WhatsApp Business") {

Expand Down Expand Up @@ -1272,27 +1272,27 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
this.getInstallations().then((res: any) => {

if (res) {
console.log("[HOME] getInstallations res: ", res)
console.log("[HOME] getInstallations - whatsAppIsInstalled ", this.whatsAppIsInstalled)
console.log("[HOME] getInstallations - solution_channel ", this.solution_channel_for_child)
console.log('[HOME] getInstallations - whatsAppAppId ', this.whatsAppAppId)
console.log("[HOME] getInstallations - userHasUnistalledWa ", this.userHasUnistalledWa)
console.log("[HOME] getInstallations - solution_channel_for_child ", this.solution_channel_for_child)
this.logger.log("[HOME] getInstallations res: ", res)
this.logger.log("[HOME] getInstallations - whatsAppIsInstalled ", this.whatsAppIsInstalled)
this.logger.log("[HOME] getInstallations - solution_channel ", this.solution_channel_for_child)
this.logger.log('[HOME] getInstallations - whatsAppAppId ', this.whatsAppAppId)
this.logger.log("[HOME] getInstallations - userHasUnistalledWa ", this.userHasUnistalledWa)
this.logger.log("[HOME] getInstallations - solution_channel_for_child ", this.solution_channel_for_child)
if (res.length > 0) {
console.log("[HOME] USE CASE RES > 0 ", this.solution_channel_for_child)
this.logger.log("[HOME] USE CASE RES > 0 ", this.solution_channel_for_child)
const WAInstallationIndex = res.findIndex((e) => e.app_id === this.whatsAppAppId);
console.log('[HOME] getInstallations WA app index', WAInstallationIndex)
this.logger.log('[HOME] getInstallations WA app index', WAInstallationIndex)
if (WAInstallationIndex === -1) {
this.whatsAppIsInstalled = false;
console.log('HERE YES 1 whatsAppIsInstalled ', this.whatsAppIsInstalled)
this.logger.log('HERE YES 1 whatsAppIsInstalled ', this.whatsAppIsInstalled)
if (this.userHasUnistalledWa === false) {
console.log("[HOME] getInstallations - userHasUnistalledWa 2 ", this.userHasUnistalledWa)
this.logger.log("[HOME] getInstallations - userHasUnistalledWa 2 ", this.userHasUnistalledWa)
if (this.solution_channel_for_child === 'whatsapp_fb_messenger') {
this.installApp();
}
}
} else {
console.log('HERE YES 2 whatsAppIsInstalled ', this.whatsAppIsInstalled)
this.logger.log('HERE YES 2 whatsAppIsInstalled ', this.whatsAppIsInstalled)
this.whatsAppIsInstalled = true


Expand Down Expand Up @@ -1397,9 +1397,9 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {
}
}

console.log('[HOME] appId installApp', this.whatsAppAppId)
console.log('[HOME] app app version installApp', this.appVersion)
console.log('[HOME] installationType installApp', this.installActionType);
this.logger.log('[HOME] appId installApp', this.whatsAppAppId)
this.logger.log('[HOME] app app version installApp', this.appVersion)
this.logger.log('[HOME] installationType installApp', this.installActionType);

this.installV2App(this.projectId, this.whatsAppAppId)

Expand All @@ -1408,7 +1408,7 @@ export class HomeComponent implements OnInit, OnDestroy, AfterViewInit {

installV2App(projectId, appId) {
this.appStoreService.installAppVersionTwo(projectId, appId).subscribe((res: any) => {
console.log('[HOME] INSTALL V2 APP ', projectId, appId)
this.logger.log('[HOME] INSTALL V2 APP ', projectId, appId)

}, (error) => {
this.logger.error('[HOME] INSTALL V2 APP - ERROR ', error);
Expand Down
2 changes: 1 addition & 1 deletion src/app/knowledge-bases/knowledge-bases.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ export class KnowledgeBasesComponent implements OnInit {
gptkey: this.kbSettings.gptkey
}
this.openaiService.startScraping(data).subscribe((response: any) => {
console.log("start scraping response: ", response);
this.logger.log("start scraping response: ", response);
if (response.message && response.message === "Invalid Openai API key") {
this.notify.showWidgetStyleUpdateNotification("Invalid Openai API key", 4, 'report_problem');
}
Expand Down

0 comments on commit 6e14930

Please sign in to comment.