import * as pgMonitor from "pg-monitor" ; import { IOptions } from "pg-promise" ; import logger from "../logger" ; pgMonitor . setTheme ( "matrix" ) ; const $DEBUG = process . env . DEBUG_SQL ; pgMonitor . setLog ( ( msg , info ) => { if ( info . event === "error" ) { logger . error ( msg ) ; } if ( ! $DEBUG ) { info . display = false ; } } ) ; export = { init ( options ) { if ( $DEBUG ) { pgMonitor . attach ( options ) ; } else { pgMonitor . attach ( options , [ "error" ] ) ; } } } ;