-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhanced Logging System with Winston Integration #69
Conversation
@Sweetdevil144 is this ready to review? |
Yes, go ahead!! |
Hey, @Sweetdevil144. As the project grows, there will be more files/classes. And we'll need to know which class is throwing out those logs. Can you also add that logger functionality to this PR as well? |
@dhruv-1001 I think I already did it by adding |
I will add the class function as you requested for it to be thrown too!! |
Update swagger.js Update app.js
@Sweetdevil144, any update on this? |
Hey @dhruv-1001 , I already added class logging property to the Logger. Just a simple guide. User will add two comments in Logging. For example Logger.error('app.js',`Error reading folder: ${err}`); It is already available for review. Any changes are welcome. |
I think the code is ready to be merged. Views @dhruv-1001 and @ChakshuGautam ?? |
@Sweetdevil144, can you make the changes i've mentioned in review? |
Can you check the changes now @dhruv-1001 ? I've added the filename to logger class so that it's passed only once when using the Logger file. For example, If you want to log in app.js, we do : import Logger from './util/logger';
const logger = new Logger('app.js'); |
@Sweetdevil144, that's great. Just update the logs everywhere according to this change, and test it out on your local. I'll then merge this PR |
Hey @dhruv-1001 and @ChakshuGautam . Can you checkout this PR? |
Can you push these changes? |
Pushed |
I guess we should remove |
@dhruv-1001 ready for review One more doubt : Why don't we have jest configured for our codebase? We can prepare our module.exports = {
transform: {
'^.+\\.js$': 'babel-jest',
},
}; It is because I have been facing the following issue while running our test cases : |
Hey @Sweetdevil144, will be reviewing this today evening. |
This LGTM. Merging this now. Moving forward we are migrating to nestjs. So, will be using logging class by nestjs. |
* Add logging --------- Co-authored-by: Sweetdevil144 <Sweetdevil144@users.noreply.github.com>
Fixes #21
Description:
This pull request introduces significant improvements to our application's logging system, leveraging the
winston
library for a more structured and effective logging approach:Logger Utility Introduction:
Logger.js
File: Implemented in theutil
directory, this file features a customLogger
class usingwinston
, standardizing logging across our codebase.Refactoring in
app.js
:console.log
andconsole.error
to theLogger
class methods for consistent logging.Adaptive Log Level Management:
Logger
sets log levels dynamically based onNODE_ENV
, ensuring appropriate verbosity in development and production modes.Log Formatting and Management:
winston
's features.