Files
9abac70427 feat/messages additions (in memory of Leonard Nimoy) (#118)
* feat(resouces/messages): broadcast messagse to participants

* feat(phone/messages): notifications for messages

* remove weird empty onNet

* reformat?

* last reformat! This pr will be squashed

* tweak(phone/messages): send groupName to notification alert

* fix identifer

* fixing notification groupName

* resbasee...i think

* feat(messages): check for unread messages

* send nui event is count > 0

* remove usless test

* import.sql update

* Refactor NotificationsProvider and fix messages notifications

* Send groupId on message broadcast

* Update phone/src/apps/messages/components/modal/Conversation.tsx

* Update phone/src/apps/messages/hooks/useMessageNotifications.ts

* Update phone/src/os/notifications/providers/NotificationsProvider.tsx

* Update phone/src/common/typings/messages.ts

* Update phone/src/apps/messages/hooks/useMessageNotifications.ts

* clean sql file

* Update resources/server/sv_messages.ts

* Fetch message groups when other person created for you

* fix sql

* Select unreadCount from messageGroups

* whatever husky again

* Add members menu and add contact in messages

* Add from group bubbles

* Fix messages scroll with new msg

* Message image menu flicker + justify bottom messages

* Improve debugging

* Add container to Slider

* Improve logger

* Fix create message

* add creator identifier to group hash

* Fix dafuq i broke

* group_id bigger varchar in column

* group_id bigger varchar in column

* Phone visibility default browser

* Add debugging

Co-authored-by: J Francisco Rader <[email protected]>
Co-authored-by: J Francisco Rader <[email protected]>
2021-03-04 18:35:33 -05:00

40 lines
1.2 KiB
TypeScript

import winston from 'winston';
import config from '../utils/config';
import path from 'path';
// Needed to manually apply a color to componenent property of log
const manualColorize = (strToColor: string): string => `[\x1b[35m${strToColor}\x1b[0m]`;
// Format handler passed to winston
const formatLogs = (log: winston.Logform.TransformableInfo): string => {
if (log.module)
return `${log.label} ${manualColorize(log.module)} [${log.level}]: ${log.message}`;
return `${log.label} [${log.level}]: ${log.message}`;
};
const findLogPath = () =>
`${path.join(GetResourcePath(GetCurrentResourceName()), 'sv_npwd.log')}`;
// Initiate the main logger for NPWD
export const mainLogger = winston.createLogger({
level: config.debug.level,
transports: [
new winston.transports.File({
filename: findLogPath(),
format: winston.format.combine(
winston.format.errors({ stack: true }),
winston.format.timestamp(),
winston.format.json(),
),
}),
new winston.transports.Console({
format: winston.format.combine(
winston.format.label({ label: '[NPWD]' }),
winston.format.colorize({ all: true }),
winston.format.printf(formatLogs),
),
}),
],
});