Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prisma-query-log

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prisma-query-log

Log prisma query event

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
787
decreased by-60.94%
Maintainers
1
Weekly downloads
 
Created
Source

prisma-query-log

Log prisma query event

Features:

  • Substitute parameters
  • Remove backticks and database prefix

Before:

After:

Install

npm install --save-dev prisma-query-log

Usage

import { createPrismaQueryEventHandler } from 'prisma-query-log';
import { PrismaClient } from '@prisma/client';

const prisma = new PrismaClient({
    log: [
        {
            level: 'query',
            emit: 'event',
        },
    ],
});

const log = createPrismaQueryEventHandler();

prisma.$on('query', log);

API

function createPrismaQueryEventHandler(
    args?: CreatePrismaQueryEventHandlerArgs,
): (event: PrismaQueryEvent) => void;

type CreatePrismaQueryEventHandlerArgs = {
    /**
     * Boolean of custom log function,
     * if true `console.log` will be used,
     * if false noop - logs nothing.
     * Default: true
     */
    logger?: boolean | ((query: string) => unknown);
    /**
     * Remove backticks.
     */
    unescape?: boolean;
};

FAQs

Package last updated on 25 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc