New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@debugr/mikroorm

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@debugr/mikroorm

MikroORM plugin for Advanced application logger

latest
npmnpm
Version
3.0.0-rc.7
Version published
Maintainers
2
Created
Source

MikroORM plugin for Debugr

This plugin provides a Logger implementation compatible with MikroORM, allowing you to add SQL logging to your tasks.

Installation

npm install --save @debugr/mikroorm

Usage

import { Logger, LogLevel } from '@debugr/core';
import { MikroORMCollector } from '@debugr/mikroorm';
import { ConsoleHandler } from '@debugr/console';
import { MikroORM } from '@mikro-orm/core';

const globalContext = {
  applicationName: 'example',
};

const logger = new Logger(globalContext, [
  new ConsoleHandler({
    threshold: LogLevel.INFO,
  }),
  new MikroORMCollector(),
]);

// inject the plugin into your MikroORM connection options
const connection = await MikroORM.init({
  // ...
  getLogger() {
    return logger.getPlugin('mikroorm');
  },
});

Options

The MikroORMCollector constructor accepts an optional options object you can use to override the default mapping between MikroORM logger namespaces and log levels on the one hand and Debugr log levels on the other. MikroORM currently defines five logger namespaces and three log levels, which are by default mapped to Debugr log levels as follows:

const defaultNamespaceMap: MikroORMNamespaceMap = {
  discovery: LogLevel.DEBUG,
  info: LogLevel.INFO,
  query: LogLevel.INFO,
  'query-params': LogLevel.INFO,
  schema: LogLevel.INFO,
};

const defaultLevelMap: MikroORMLevelMap = {
  info: LogLevel.DEBUG,
  warning: LogLevel.WARNING,
  error: LogLevel.ERROR,
};

You can override any of these mappings using the optional namespaces and levels keys of the options object.

FAQs

Package last updated on 15 Aug 2023

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