Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

Log all Prisma Client method executions #551

Closed
janpio opened this issue Mar 6, 2020 · 2 comments
Closed

Log all Prisma Client method executions #551

janpio opened this issue Mar 6, 2020 · 2 comments
Assignees
Labels
kind/improvement An improvement to existing feature and code.

Comments

@janpio
Copy link
Member

janpio commented Mar 6, 2020

We are developing a tool that uses prisma-test-utils to generate data for all models in all Introspection schemas. Right now, all >100 models are failing with multiple errors.

We are using DEBUG=* to get all the possible debugging information, which is already quite helpful. The only bit that is missing, is the Prisma Client call that was actually executed to cause the error.

It would be nice if every Prisma Client method executions would be logged to the DEBUG output.

Example

+ 2020-03-05T16:56:56.120Z prisma-client Prisma Client call:
+ 2020-03-05T16:56:56.120Z prisma-client  [ prisma.ahoy_events.createOne({
+      ...
+    })
+ ]
2020-03-05T16:56:56.120Z prisma-client Requests:
2020-03-05T16:56:56.121Z prisma-client [
  'mutation {\n' +
    '  createOneahoy_events(data: {\n' +
    '    created_at: "2024-06-26T14:40:10.450Z"\n' +
    '    id: "ba000471-eabd-55d2-8b42-8ac91ec57e13"\n' +
    '    name: "sab"\n' +
    '    properties: "ziwiwwuh"\n' +
    '    time: "2077-02-06T12:02:57.325Z"\n' +
    '    type: "zeenejom"\n' +
    '    updated_at: "2034-04-09T19:09:04.015Z"\n' +
    '    user_id: 2091163462\n' +
    '    visit_id: "mahbu"\n' +
    '  }) {\n' +
    '    created_at\n' +
    '    id\n' +
    '    name\n' +
    '    properties\n' +
    '    time\n' +
    '    type\n' +
    '    updated_at\n' +
    '    user_id\n' +
    '    visit_id\n' +
    '  }\n' +
    '}'
]
2020-03-05T16:56:56.680Z engine stdout {
  timestamp: 'Mar 05 16:56:56.679',
  level: 'ERROR',
  target: 'prisma',
  fields: {
    message: 'PANIC',
    reason: 'internal error: entered unreachable code',
    file: 'query-engine/core/src/response_ir/mod.rs',
    line: 281,
    column: 38
  }
}
@janpio janpio added the kind/improvement An improvement to existing feature and code. label Mar 6, 2020
@janpio janpio added this to the Preview 24 New milestone Mar 6, 2020
@janpio janpio assigned janpio and timsuchanek and unassigned janpio Mar 6, 2020
@timsuchanek
Copy link
Contributor

Thanks a lot for reporting 🙏
This issue is fixed in the latest alpha version of prisma2.
It's implemented like so:
image

You can try it out with npm i -g prisma2@alpha.

@janpio
Copy link
Member Author

janpio commented Mar 6, 2020

What alpha was this published with? 880 does not seem to have it (or I do not know how to trigger)
What do we have to do to get the output? (set DEBUG=* is not enough?)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/improvement An improvement to existing feature and code.
Projects
None yet
Development

No branches or pull requests

2 participants