Fix jwt-token
This commit is contained in:
@@ -3,7 +3,7 @@ const path = require('path');
|
|||||||
|
|
||||||
class ApiDebugLogger {
|
class ApiDebugLogger {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.logFile = path.join(__dirname, '..', '..', 'api_debug.log');
|
this.logFile = path.join(__dirname, '..', 'logs', 'api_debug.log');
|
||||||
this.enabled = process.env.NODE_ENV === 'development' || process.env.API_DEBUG === 'true';
|
this.enabled = process.env.NODE_ENV === 'development' || process.env.API_DEBUG === 'true';
|
||||||
|
|
||||||
// Debug logging setup
|
// Debug logging setup
|
||||||
@@ -11,8 +11,14 @@ class ApiDebugLogger {
|
|||||||
console.log(`🐛 ApiDebugLogger: Enabled (NODE_ENV=${process.env.NODE_ENV}, API_DEBUG=${process.env.API_DEBUG})`);
|
console.log(`🐛 ApiDebugLogger: Enabled (NODE_ENV=${process.env.NODE_ENV}, API_DEBUG=${process.env.API_DEBUG})`);
|
||||||
console.log(`🐛 ApiDebugLogger: Log file path: ${this.logFile}`);
|
console.log(`🐛 ApiDebugLogger: Log file path: ${this.logFile}`);
|
||||||
|
|
||||||
// Ensure the log file exists
|
// Ensure the logs directory exists
|
||||||
try {
|
try {
|
||||||
|
const logsDir = path.dirname(this.logFile);
|
||||||
|
if (!fs.existsSync(logsDir)) {
|
||||||
|
fs.mkdirSync(logsDir, { recursive: true });
|
||||||
|
console.log(`🐛 ApiDebugLogger: Created logs directory at ${logsDir}`);
|
||||||
|
}
|
||||||
|
|
||||||
if (!fs.existsSync(this.logFile)) {
|
if (!fs.existsSync(this.logFile)) {
|
||||||
fs.writeFileSync(this.logFile, `# API Debug Log Started at ${new Date().toISOString()}\n`);
|
fs.writeFileSync(this.logFile, `# API Debug Log Started at ${new Date().toISOString()}\n`);
|
||||||
console.log(`🐛 ApiDebugLogger: Created log file at ${this.logFile}`);
|
console.log(`🐛 ApiDebugLogger: Created log file at ${this.logFile}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user