@eropple/typeorm-bunyan-logger

0.1.0 • Public • Published

@eropple/typeorm-bunyan-logger

This package provides a TypeORM logger adapter that works with Bunyan.

Usage

Just create a TypeOrmLoggerAdapter with your preferred logger and pass it to the logger connection option. The logger will have a component name of TypeORM.

It is set up to support the logging of slow queries and queries that error. It will not dump parameters for any query to the log.

Configuration Example (ormconfig.ts)

import { ConnectionOptions } from "typeorm";
import * as Bunyan from "bunyan";
import { TypeOrmLoggerAdapter } from "@eropple/typeorm-bunyan-logger";

const ROOT_LOGGER = Bunyan.createLogger({ name: "mycoolapp", level: Bunyan.DEBUG });

const dbOptions: ConnectionOptions = {
  type: "postgres",
  host: "localhost",
  port: 5432,
  logging: true,
  logger: new TypeOrmLoggerAdapter(ROOT_LOGGER)
};

module.exports = dbOptions;

Readme

Keywords

none

Package Sidebar

Install

npm i @eropple/typeorm-bunyan-logger

Weekly Downloads

71

Version

0.1.0

License

MIT

Unpacked Size

43.2 kB

Total Files

13

Last publish

Collaborators

  • eropple