Skip to content

Commit

Permalink
fixed log
Browse files Browse the repository at this point in the history
  • Loading branch information
mtp0326 committed Oct 1, 2024
1 parent eb35147 commit bbacd69
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
2 changes: 1 addition & 1 deletion server/src/config/configDatadog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ const logger_error = winston.createLogger({
transports: [new winston.transports.Console()],
});

logger_warn.warn('Logger Initialized');
logger_info.info('Logger Initialized');

export { tracer, logger_info, logger_warn, logger_error };
18 changes: 3 additions & 15 deletions server/src/controllers/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* user's authentication such as login, logout, and registration.
*/
import express from 'express';
import { tracer, logger_info } from '../config/configDatadog.ts';
import { logger_info } from '../config/configDatadog.ts';
import passport from 'passport';
import crypto from 'crypto';
import { hash } from 'bcrypt';
Expand Down Expand Up @@ -34,14 +34,6 @@ import mixpanel from '../config/configMixpanel.ts';
* Else, send an appropriate error message.
*/

// Start a new span for the authentication process
const span = tracer.startSpan('authentication', {
tags: {
// 'user.username': username,
'span.kind': 'server',
},
});

const login = async (
req: express.Request,
res: express.Response,
Expand Down Expand Up @@ -84,13 +76,11 @@ const login = async (
});

// Datadog login
logger_info.log('info', 'Login');
span.setTag('http.status_code', 200);
logger_info.log('Login');
res.status(StatusCode.OK).send(user);
});
},
)(req, res, next);
span.finish();
};

/**
Expand Down Expand Up @@ -118,16 +108,14 @@ const logout = async (
});
}
// Datadog logout
logger_info.log('info', 'Logout');
span.setTag('http.status_code', 200);
logger_info.log('Logout');

// Mixpanel logout tracking
mixpanel.track('Logout', {
distinct_id: req.user ? (req.user as IUser)._id : undefined,
email: req.user ? (req.user as IUser).email : undefined,
});
});
span.finish();
};

/**
Expand Down

0 comments on commit bbacd69

Please sign in to comment.