
- Updated `.env` and added `.env.test` for environment variables. - Introduced API documentation in `API_DOCUMENTATION.md`. - Added authentication setup guide in `AUTHENTICATION_SETUP.md`. - Implemented user authentication with JWT and email verification. - Created new routes for user management and form submissions. - Added middleware for API key authentication and error handling. - Set up Redis for rate limiting and notifications. - Removed obsolete files and configurations related to the previous Rust implementation.
30 lines
803 B
JavaScript
30 lines
803 B
JavaScript
const winston = require("winston");
|
|
|
|
const logger = winston.createLogger({
|
|
level: "info",
|
|
format: winston.format.json(),
|
|
defaultMeta: { service: "user-service" },
|
|
transports: [
|
|
//
|
|
// - Write all logs with importance level of `error` or less to `error.log`
|
|
// - Write all logs with importance level of `info` or less to `combined.log`
|
|
//
|
|
new winston.transports.File({ filename: "error.log", level: "error" }),
|
|
new winston.transports.File({ filename: "combined.log" }),
|
|
],
|
|
});
|
|
|
|
//
|
|
// If we're not in production then log to the `console` with the format:
|
|
// `${info.level}: ${info.message} JSON.stringify({ ...rest }) `
|
|
//
|
|
if (process.env.NODE_ENV !== "production") {
|
|
logger.add(
|
|
new winston.transports.Console({
|
|
format: winston.format.simple(),
|
|
})
|
|
);
|
|
}
|
|
|
|
module.exports = logger;
|