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

feat: better logging #62

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

feat: better logging #62

wants to merge 1 commit into from

Conversation

G0maa
Copy link
Member

@G0maa G0maa commented Oct 19, 2024

  1. Write logs to file groups (db, graphql, error).
  2. Rotate logs (every 14 days).
  3. Log GraphQL requests (specifics might change on production).

This will be needed by #57.

Copy link

netlify bot commented Oct 19, 2024

Deploy Preview for disworse ready!

Name Link
🔨 Latest commit 895925d
🔍 Latest deploy log https://app.netlify.com/sites/disworse/deploys/67137999a4a9630008d27796
😎 Deploy Preview https://deploy-preview-62--disworse.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Oct 19, 2024

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not the place of configs. A separate config module is required.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bassiounix This is a feature request, we can create a separate issue for this.

The intention of this PR is to add logging, not create a config module.

BaseContext,
GraphQLRequestContext,
GraphQLRequestContextWillSendResponse,
GraphQLRequestListener,
Copy link
Contributor

@bassiounix bassiounix Oct 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused import

Suggested change
GraphQLRequestListener,
Remove `GraphQLRequestListener`

export class ApolloLogger implements ApolloServerPlugin {
private readonly logger = new Logger("GraphQL");

async requestDidStart(requestContext: GraphQLRequestContext<BaseContext>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mark full access specifier as the logger

Suggested change
async requestDidStart(requestContext: GraphQLRequestContext<BaseContext>) {
public async requestDidStart(requestContext: GraphQLRequestContext<BaseContext>) {

@@ -26,7 +30,10 @@ export class TransactionInterceptor implements NestInterceptor {
const gqlContext = GqlExecutionContext.create(context);
const ctx = gqlContext.getContext();

const db = drizzle(this.pool, { schema });
const db = drizzle(this.pool, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the db is not injected?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ya 3ammena, separate issue wallah 😭 See #2

Copy link
Contributor

@bassiounix bassiounix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. However, I didn't try to run logs locally!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants