From d4ddf3acf06cb2063d4c4128fcda05ba8f2c78ab Mon Sep 17 00:00:00 2001 From: uurgothat Date: Mon, 4 Oct 2021 22:01:08 +0300 Subject: [PATCH] Rainbow the logs --- bundle/package-lock.json | Bin 99567 -> 99511 bytes bundle/package.json | 3 ++- bundle/src/Server.ts | 3 ++- bundle/src/start.ts | 20 +++++++++++++++++++- bundle/src/stats.ts | 1 + cdn/src/util/Storage.ts | 3 ++- util/package-lock.json | Bin 459116 -> 459139 bytes util/package.json | 1 + util/src/util/Database.ts | 5 +++-- 9 files changed, 30 insertions(+), 6 deletions(-) diff --git a/bundle/package-lock.json b/bundle/package-lock.json index aaa0c1eee885087de403cbf3094da6476dbcd8ee..220c917706724d160eb8d4692c8666548ab2e3b3 100644 GIT binary patch delta 563 zcmaFg$+o?dZNpYZ{^X3roNOg41*JF>JwrXC$q(3+HlJsdW@0ijnEXysY4Sd9fz7fk zaYFn$T%4SoO8EsPnfZB%IWCh8Pm4)amS$&WCsw8ECgqptrxxWDBql@5GMs!cN_caN zn6nzA(ey-4Myu&I?2LSq70nbw(>+atbBqm2ax)@|3$y*o@(bK5Qv%E#gOg2?jgo!R z-2DQJ!o2;ABPv05diu z>}3QorkkiSN^M@9q`^3O%WkpFKa<}nPQJNTdNSuB+0FWGwbo$87Y_QX%HsB{o`K%v zhujvMeV=cUr?-EnJ8(0yPhQQ<3-;*btG3UlJ1{azPVUp?n(T0#eex?irO69^uy42F zWDMq;E~U>XG-0e427%dqgOkh}WGH&-(XN;BIzRQI%$p|8BSI)SR F7XS;rzwrP7 delta 459 zcmdnq$@adJZNpZ^$vYlPP5${@Z?g!~TgJ)jM3pB82nlR9Wr-8od`HYjjmgk#@HUEGcHJ%bGcOnoyPBTTbHQ;JN?EDM7w3yUN5eX|nte6ot&k^(0isvB&U zu-hd#Ik#G6`blv{*~u$bD{fW^*eNi1Za3fL4Mt*{KPK#DoSYL2=1kX7W0cx_CrN{G zdZ|654sEs8lh1wPn7lzwW;$Crqr~Qy2hCL{ z_p<11E`7d5o_?NdRFau|{}cOm9uCIU{FAe*1*RLYFbZu4dXtTJ^6YLX_n``-CFA6% w?@HT&p5uggY`dL0V~FhJ7A48a4sGwZceyfV8BRX)iEFaK4T { console.log( - `[Worker] died with pid: ${worker.process.pid} , restarting ...` + `[Worker] ${red(`died with pid: ${worker.process.pid} , restarting ...`)}` ); cluster.fork(); }); diff --git a/bundle/src/stats.ts b/bundle/src/stats.ts index e6941db2..5dc69efe 100644 --- a/bundle/src/stats.ts +++ b/bundle/src/stats.ts @@ -1,5 +1,6 @@ import os from "os"; import osu from "node-os-utils"; +import {} from "chalk"; export function initStats() { console.log(`[Path] running in ${__dirname}`); diff --git a/cdn/src/util/Storage.ts b/cdn/src/util/Storage.ts index 5cf1eb80..8ae44bbb 100644 --- a/cdn/src/util/Storage.ts +++ b/cdn/src/util/Storage.ts @@ -1,6 +1,7 @@ import { FileStorage } from "./FileStorage"; import path from "path"; import fse from "fs-extra"; +import { bgCyan, black } from "chalk"; process.cwd(); export interface Storage { @@ -18,7 +19,7 @@ if (process.env.STORAGE_PROVIDER === "file" || !process.env.STORAGE_PROVIDER) { } else { location = path.join(process.cwd(), "files"); } - console.log(`[CDN] storage location: ${location}`); + console.log(`[CDN] storage location: ${bgCyan(`${black(location)}`)}`); fse.ensureDirSync(location); process.env.STORAGE_LOCATION = location; diff --git a/util/package-lock.json b/util/package-lock.json index f412961430c0fff63d0f6f363743b7c9e0762666..26321ee9abcb1ba3f7adbd7747b5fe31b1bcd99e 100644 GIT binary patch delta 49 wcmaFUB-7k1vq6P%vUMFdv!R|*vovG7G$RNz0WmWWvj8zG5VK8}W@HZp07_K~{r~^~ delta 41 ocmZo}mU+`8vq6Qi*_yH4nh}JVfS4JGS%8=oh}ouFGqQUC0QTq#3IG5A diff --git a/util/package.json b/util/package.json index 0e81a544..426b4e43 100644 --- a/util/package.json +++ b/util/package.json @@ -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", diff --git a/util/src/util/Database.ts b/util/src/util/Database.ts index ab7c70c5..bf8c6fce 100644 --- a/util/src/util/Database.ts +++ b/util/src/util/Database.ts @@ -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;