diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 4e2b0c4..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "cSpell.words": [ - "accrole", - "accuserrole", - "adminregion", - "Akabari", - "codepaths", - "DATEONLY", - "Emaillog", - "encryptdecrypt", - "exceljs", - "exphbs", - "extr", - "fieldname", - "Geet", - "gpsd", - "hallodoc", - "hamare", - "heent", - "hellodoc", - "hpaa", - "Includeable", - "Maidaan", - "neuro", - "nonblock", - "parens", - "Phonenumber", - "rahte", - "requeststatuslog", - "requesttype", - "rolepermissionmap", - "splitdata", - "tsbuildinfo" - ], - "cSpell.language": "en,en-GB,en-US,lorem" -} diff --git a/src/utils/logger.ts b/src/utils/logger.ts index 8360466..4be59d5 100644 --- a/src/utils/logger.ts +++ b/src/utils/logger.ts @@ -1,15 +1,15 @@ import winston from 'winston'; export const logger = winston.createLogger({ - level: 'info', // Set the desired log level (e.g., 'info', 'error', 'debug') + level: 'info', format: winston.format.combine( winston.format.colorize(), - winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), // Customize timestamp format + winston.format.timestamp({ format: 'YYYY-MM-DD HH:mm:ss' }), winston.format.printf(({ timestamp, level, message }) => { return `${timestamp} [${level}]: ${message}`; }), ), transports: [ - new winston.transports.Console(), // Log to console (you can add more transports here) + new winston.transports.Console(), ], }); diff --git a/src/utils/multerConfig.ts b/src/utils/multerConfig.ts index e91ee8a..6f6aadb 100644 --- a/src/utils/multerConfig.ts +++ b/src/utils/multerConfig.ts @@ -2,7 +2,7 @@ import multer, { StorageEngine } from 'multer'; import { Request } from 'express'; import { existsSync } from 'fs'; -const uploadDirectory = './src/public/images' +const uploadDirectory = './src/public/images'; export const fileStorage: StorageEngine = multer.diskStorage({ destination: (req, file, cb) => { cb(null, uploadDirectory); @@ -10,11 +10,11 @@ export const fileStorage: StorageEngine = multer.diskStorage({ filename: (req, file, cb) => { let fileName = file.originalname; const extension = fileName.split('.').pop(); - const baseFileName = fileName.substring(0, fileName.lastIndexOf('.')) + const baseFileName = fileName.substring(0, fileName.lastIndexOf('.')); let counter = 1; - while(existsSync(`${uploadDirectory}/${fileName}`)) { - fileName = `${baseFileName} (${counter}).${extension}` + while (existsSync(`${uploadDirectory}/${fileName}`)) { + fileName = `${baseFileName} (${counter}).${extension}`; counter++; } cb(null, fileName);