Rainbow the logs

This commit is contained in:
uurgothat
2021-10-04 22:01:08 +03:00
parent e52e7ef0e1
commit d4ddf3acf0
9 changed files with 46 additions and 28 deletions
+1
View File
@@ -12,6 +12,7 @@
"dependencies": {
"ajv": "^8.6.2",
"amqplib": "^0.8.0",
"chalk": "^4.1.2",
"class-validator": "^0.13.1",
"dot-prop": "^6.0.1",
"env-paths": "^2.2.1",
+1
View File
@@ -39,6 +39,7 @@
"dependencies": {
"ajv": "^8.6.2",
"amqplib": "^0.8.0",
"chalk": "^4.1.2",
"class-validator": "^0.13.1",
"dot-prop": "^6.0.1",
"env-paths": "^2.2.1",
+3 -2
View File
@@ -2,6 +2,7 @@ import path from "path";
import "reflect-metadata";
import { Connection, createConnection, ValueTransformer } from "typeorm";
import * as Models from "../entities";
import { yellow, green} from "chalk";
// UUID extension option is only supported with postgres
// We want to generate all id's with Snowflakes that's why we have our own BaseEntity class
@@ -12,7 +13,7 @@ var dbConnection: Connection | undefined;
export function initDatabase() {
if (promise) return promise; // prevent initalizing multiple times
console.log("[Database] connecting ...");
console.log(`[Database] ${yellow("connecting ...")}`);
// @ts-ignore
promise = createConnection({
type: "sqlite",
@@ -32,7 +33,7 @@ export function initDatabase() {
promise.then((connection) => {
dbConnection = connection;
console.log("[Database] connected");
console.log(`[Database] ${green("connected")}`);
});
return promise;