From f7c9246a67092fff6f609d1f77980e8e8253bab7 Mon Sep 17 00:00:00 2001 From: Jeff Way Date: Thu, 15 Feb 2024 10:26:11 -0800 Subject: [PATCH] Add additional debugging messages --- src/server.cjs | 5 +++++ src/start.js | 2 +- src/start_and_log.js | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/server.cjs b/src/server.cjs index 4d57188..6ccd831 100644 --- a/src/server.cjs +++ b/src/server.cjs @@ -1,10 +1,15 @@ +const { debug } = require('@actions/core'); const { createApp } = require('turborepo-remote-cache'); +debug('Creating Turbo Cache Server...'); const app = createApp({trustProxy: true}); +debug(`Starting listening for requests on ${process.env.HOST}:${process.env.PORT}...`); app.listen({ host: process.env.HOST, port: process.env.PORT }, (err) => { if (err) { console.error(err); process.exit(1); } }); + +debug('Turbo Cache Server started successfully!'); diff --git a/src/start.js b/src/start.js index f33788a..b5a047f 100644 --- a/src/start.js +++ b/src/start.js @@ -36,7 +36,7 @@ async function main() { [resolve(__dirname, '..', 'start_and_log')], { detached: true, - stdio: 'ignore', + stdio: 'pipe', env: { ...process.env, HOST: host, diff --git a/src/start_and_log.js b/src/start_and_log.js index 536dba6..02a9398 100644 --- a/src/start_and_log.js +++ b/src/start_and_log.js @@ -1,3 +1,4 @@ +import { debug } from '@actions/core'; import { spawn } from 'node:child_process'; import { createWriteStream } from 'node:fs'; import { dirname, resolve } from 'node:path'; @@ -6,7 +7,7 @@ import { logFile } from './logs.js'; const __dirname = dirname(fileURLToPath(import.meta.url)); +debug('Starting Server Process...'); const subprocess = spawn('node', [resolve(__dirname, '..', 'server', 'index.cjs')]); - subprocess.stdout.pipe(createWriteStream(logFile('out'))); subprocess.stderr.pipe(createWriteStream(logFile('err'))); \ No newline at end of file