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

chore(app): create the logger package #5

Merged
merged 3 commits into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
feat: use the logger in the application
  • Loading branch information
tericcabrel committed Mar 28, 2022
commit 9d23d3ec8bfb5c84ebca7ca71e780c65af61e6da
10 changes: 10 additions & 0 deletions apps/core/src/configs/logger.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import path from 'path';
import { fileLogger } from '@sharingan/logger';

fileLogger.init({
appName: 'core',
logFileDirectory: path.resolve(__dirname, '../../logs'),
logToSentry: false,
});

export { fileLogger as logger };
3 changes: 2 additions & 1 deletion apps/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import typeDefs from './resources/newsletter/schema';
import { resolvers } from './resources/newsletter/resolvers';
import { sortNumbers } from '@sharingan/utils';
import { env } from './configs/env';
import { logger } from './configs/logger';

const server = new ApolloServer({
healthCheckPath: '/health',
Expand All @@ -14,5 +15,5 @@ const server = new ApolloServer({
console.log(sortNumbers([67, 80, 4, 11, 90, 54, 22]));

void server.listen({ port: env.PORT }).then(({ url }) => {
console.log(`🚀 Server ready at ${url}graphql`);
logger.info(`🚀 Server ready at ${url}graphql`);
});