0.1.0 • Published 5 years ago

@eropple/typeorm-bunyan-logger v0.1.0

Weekly downloads
258
License
MIT
Repository
github
Last release
5 years ago

@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;
0.1.0

5 years ago

0.1.0-rc.1

5 years ago