aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/ActionUtilities.ts8
-rw-r--r--src/server/index.ts5
2 files changed, 10 insertions, 3 deletions
diff --git a/src/server/ActionUtilities.ts b/src/server/ActionUtilities.ts
index 9a009791b..b418772a6 100644
--- a/src/server/ActionUtilities.ts
+++ b/src/server/ActionUtilities.ts
@@ -25,4 +25,10 @@ export const write_text_file = (relativePath: string, contents: any) => {
return new Promise<void>((resolve, reject) => {
fs.writeFile(target, contents, (err) => err ? reject(err) : resolve());
});
-}; \ No newline at end of file
+};
+
+export async function log_execution(startMessage: string, endMessage: string, contents: () => void | Promise<void>) {
+ console.log('\x1b[36m%s\x1b[0m', `${startMessage}...`);
+ await contents();
+ console.log(endMessage);
+} \ No newline at end of file
diff --git a/src/server/index.ts b/src/server/index.ts
index 773b84403..569f2e139 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -18,6 +18,7 @@ import { GoogleCredentialsLoader } from './credentials/CredentialsLoader';
import DeleteManager from "./ApiManagers/DeleteManager";
import PDFManager from "./ApiManagers/PDFManager";
import UploadManager from "./ApiManagers/UploadManager";
+import { log_execution } from "./ActionUtilities";
import GeneralGoogleManager from "./ApiManagers/GeneralGoogleManager";
import GooglePhotosManager from "./ApiManagers/GooglePhotosManager";
@@ -42,7 +43,7 @@ async function preliminaryFunctions() {
// divide the public directory based on type
await Promise.all(Object.keys(Partitions).map(partition => DashUploadUtils.createIfNotExists(filesDirectory + partition)));
// connect to the database
- await Database.tryInitializeConnection();
+ await log_execution("attempting to initialize database connection", "connected", Database.tryInitializeConnection);
}
/**
@@ -103,6 +104,6 @@ function routeSetter(router: RouteManager) {
}
(async function start() {
- await preliminaryFunctions();
+ await log_execution("starting execution of preliminary functions", "completed preliminary functions", preliminaryFunctions);
await initializeServer({ listenAtPort: 1050, routeSetter });
})();