From 8f76e8f9cd0d1b1ed51e757f57f76a84f8422eb4 Mon Sep 17 00:00:00 2001 From: Shailesh Baldaniya Date: Wed, 16 Mar 2022 21:12:53 +0530 Subject: [PATCH] Chore: Remove Unnecessary Logs (#1118) * Remove Unnecessary Logs * Fix dummyLogger * Fix dummyLogger * Fix meteor method roles/get --- app/models/server/index.js | 2 ++ .../livechat-enterprise/server/lib/logger.ts | 23 +++++++++++++++---- server/publications/roles.js | 4 ++-- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/app/models/server/index.js b/app/models/server/index.js index b871507a0b29..bde57f3480f1 100644 --- a/app/models/server/index.js +++ b/app/models/server/index.js @@ -2,6 +2,7 @@ import { Base } from './models/_Base'; import { BaseDb } from './models/_BaseDb'; import Messages from './models/Messages'; import Rooms from './models/Rooms'; +import { Roles } from './raw'; import Settings from './models/Settings'; import Subscriptions from './models/Subscriptions'; import Users from './models/Users'; @@ -28,6 +29,7 @@ export { BaseDb, Messages, Rooms, + Roles, Settings, Subscriptions, Users, diff --git a/ee/app/livechat-enterprise/server/lib/logger.ts b/ee/app/livechat-enterprise/server/lib/logger.ts index 85a72ad6858c..f74385217171 100644 --- a/ee/app/livechat-enterprise/server/lib/logger.ts +++ b/ee/app/livechat-enterprise/server/lib/logger.ts @@ -2,7 +2,22 @@ import { Logger } from '../../../../../app/logger/server'; export const logger = new Logger('LivechatEnterprise'); -export const queriesLogger = logger.section('Queries'); -export const queueLogger = logger.section('Queue'); -export const helperLogger = logger.section('Helper'); -export const cbLogger = logger.section('Callbacks'); +// WIDECHAT +const dummyLogger = { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + debug: (..._args: any[]): void => { + // We don't need to log this because it spams elastic search with too many unnecessary logs + }, +}; + +export const queriesLogger = dummyLogger; +export const queueLogger = dummyLogger; +export const helperLogger = dummyLogger; +export const cbLogger = dummyLogger; +export const bhLogger = dummyLogger; + +// export const queriesLogger = logger.section('Queries'); +// export const queueLogger = logger.section('Queue'); +// export const helperLogger = logger.section('Helper'); +// export const cbLogger = logger.section('Callbacks'); +// export const bhLogger = logger.section('Business-Hours'); diff --git a/server/publications/roles.js b/server/publications/roles.js index e34702c06ebd..e25652d68446 100644 --- a/server/publications/roles.js +++ b/server/publications/roles.js @@ -3,12 +3,12 @@ import { Meteor } from 'meteor/meteor'; import { Roles } from '../../app/models'; Meteor.methods({ - 'roles/get'() { + async 'roles/get'() { if (!Meteor.userId()) { return []; } - const records = Roles.find().fetch(); + const records = await Roles.find().toArray(); return records; },