Explorar o código

Write homepage.log into config folder
This will make it easier for people to find their log file(s)

Jason Fischer %!s(int64=2) %!d(string=hai) anos
pai
achega
5776544c20
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      src/utils/logger.js

+ 5 - 1
src/utils/logger.js

@@ -1,5 +1,9 @@
+import { join } from "path";
+
 import winston from "winston";
 
+const configPath = join(process.cwd(), "config");
+
 function messageFormatter(logInfo) {
   if (logInfo.stack) {
     return `[${logInfo.timestamp}] ${logInfo.level}: ${logInfo.stack}`;
@@ -33,7 +37,7 @@ const logger = winston.createLogger({
 
     new winston.transports.File({
       format: fileFormat,
-      filename: 'homepage.log',
+      filename: `${configPath}/logs/homepage.log`,
       handleExceptions: true,
       handleRejections: true
     }),