Skip to content

Commit

Permalink
remove logs folder
Browse files Browse the repository at this point in the history
  • Loading branch information
BurakYs committed May 26, 2024
1 parent ab01efe commit b010984
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 15 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/node_modules
.tap
.vscode
.idea
/dist
/logs
.env
package-lock.json
pnpm-lock.yaml
package-lock.json
10 changes: 0 additions & 10 deletions src/helpers/Logger.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
import { ILogObj, ILogObjMeta, Logger } from 'tslog';
import { appendFileSync } from 'fs';
import loggerSettings from '@/config/logger';

export default class CustomLogger extends Logger<ILogObj> {
constructor() {
super(loggerSettings);

this.attachTransport((logObj) => {
const meta = logObj._meta || {};
const message = Object.entries(logObj).filter(([key]) => !isNaN(parseInt(key))).map(([, value]) => value).join(' ');

if (meta.logLevelName === 'REQUEST') {
appendFileSync('./logs/request.log', `${new Date(meta.date).toISOString()} ${message}\n`);
}
});
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export default class Server {

global.logger.error(error);
response.sendError('Internal Server Error', 500);
return;
});

this.server.setNotFoundHandler((request: Request, response: Response) => {
Expand Down

0 comments on commit b010984

Please sign in to comment.