twilio-opencode

A lightweight express server to handle Twilio voice and messaging webhooks for prompting Opencode.
git clone https://unitehenry.com/git/twilio-opencode.git
Log | Files | Refs | README | LICENSE

commit 849c1855f6107aa5099d57bf2be25cfed1518f58
parent 9116735997714bc3e35fe9483e7d2b1a36a6cf61
Author: Henry Unite <unitehenry@gmail.com>
Date:   Thu, 26 Feb 2026 08:09:16 +0000

feat: logger

Diffstat:
Mapp.ts | 3++-
Alog.ts | 18++++++++++++++++++
Mscripts/serve.sh | 4+++-
3 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/app.ts b/app.ts @@ -1,4 +1,5 @@ import express, { type Request, type Response } from "express"; +import log, { LogLevel } from './log.ts'; import { prompt } from './prompt.ts'; const app = express(); @@ -85,5 +86,5 @@ app.get("/health", (req, res) => res.sendStatus(200)); const port: number = parseInt(process.env.PORT || "3000", 10); app.listen(port, (): void => { - console.log(`Server running on port ${port}`); + log(LogLevel.INFO, `Server running on port ${port}`); }); diff --git a/log.ts b/log.ts @@ -0,0 +1,18 @@ +export enum LogLevel { + 'INFO', + 'WARN', + 'ERROR' +} + +export default function log(level : LogLevel, message : string, data : Record<string, any> = {}) : void { + const time = new Date().toISOString(); + + const entry = { + level, + time, + message, + ...data, + }; + + process.stdout.write(JSON.stringify(entry) + '\n'); +} diff --git a/scripts/serve.sh b/scripts/serve.sh @@ -1,2 +1,4 @@ #!/usr/bin/env bash -node --no-warnings app.ts +node --no-warnings \ + --experimental-transform-types \ + app.ts