Something went wrong. Try again.
Ghost is lightweight headless server that enables Ghost self hosters to bridge to standard.site with ease..
Something went wrong. Try again.
918 B · 28 lines
TypeScript
at main
1234567891011121314151617181920212223242526272829// Append-only one-line-per-delivery log of webhook activity. Lives at// /data/webhook.log so it's persistent across container restarts and// readable from `gs logs`. Best-effort writes — if the disk is full or// the file is locked, we don't crash the webhook handler.
import { appendFileSync } from 'node:fs';
const LOG_PATH = process.env.GS_WEBHOOK_LOG ?? '/data/webhook.log';
export interface WebhookLogEntry { siteSlug: string; action: 'sync' | 'delete' | 'ignore' | 'rejected'; postId?: string; slug?: string; status: 'ok' | 'failed' | 'ignored' | 'rejected'; atUri?: string; error?: string; reason?: string;}
export function logWebhookDelivery(entry: WebhookLogEntry): void { const line = JSON.stringify({ ts: new Date().toISOString(), ...entry }) + '\n'; try { appendFileSync(LOG_PATH, line); } catch { // Best-effort; don't take the webhook down if logging fails. }}