Skip to content
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

긴급! 타임아웃 에러 #134

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion backend/src/app.controller.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import { Controller, Get } from '@nestjs/common';
import { AppService } from './app.service';
import { PinoLogger } from 'nestjs-pino';

@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
constructor(
private readonly logger: PinoLogger,
private readonly appService: AppService,
) {}

@Get()
async getHello() {
this.logger.info('Hello world');
return (await this.appService.getHello()) + ' Web 09 Backend';
}
}
6 changes: 5 additions & 1 deletion backend/src/common/log/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@

export function createLogger(host: string, port: number) {
if (process.env.NODE_ENV === 'prod') {
const stream = net.createConnection({ host, port });
const stream = net.createConnection({ host, port, timeout: 5000 });
stream.on('error', (err) => {
console.error('Log Stream connection error:', err);

Check warning on line 53 in backend/src/common/log/logger.ts

View workflow job for this annotation

GitHub Actions / Lint, Build and Test (backend)

Unexpected console statement
});

return pino(logstashLoggerOptions, stream);
}
return pino(consoleLoggerOptions);
Expand Down
Loading