@eropple/typeorm-bunyan-logger
v0.1.0
Published
Provides a TypeORM logging adapter for Bunyan.
Downloads
371
Readme
@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;