3.0.0-rc.1 • Published 2 years ago

@debugr/typeorm v3.0.0-rc.1

Weekly downloads
3
License
MIT
Repository
-
Last release
2 years ago

TypeORM plugin for Debugr

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

Installation

npm install --save @debugr/typeorm

Usage

import { 
  Logger, 
  Debugr, 
  LogLevel,
} from '@debugr/core';
import { TypeormLogger } from '@debugr/typeorm';
import { ConsoleLogHandler } from '@debugr/console-handler';
import { SqlConsoleFormatter } from '@debugr/sql-console-formatter';
import { createConnection } from 'typeorm';

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

// There are all dependent formatters checked and validated.
const debugr = Debugr.create(globalContext, 
  [
    ConsoleLogHandler.create(
      LogLevel.info,
    ),
  ],
  [
    TypeormLogger.create(),
    // Need to add formatter between TypeormLogger and ConsoleLogHandler
    SqlConsoleFormatter.create(),
  ],
);

// inject the plugin into your TypeORM connection options
const connection = await createConnection({
  // ...
  logger: debugr.getPlugin('typeorm'),
});
3.0.0-rc.1

2 years ago

2.0.0

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago