feat: Add centralized logging system with @link-stack/logger package
- Create new @link-stack/logger package wrapping Pino for structured logging - Replace all console.log/error/warn statements across the monorepo - Configure environment-aware logging (pretty-print in dev, JSON in prod) - Add automatic redaction of sensitive fields (passwords, tokens, etc.) - Remove dead commented-out logger file from bridge-worker - Follow Pino's standard argument order (context object first, message second) - Support log levels via LOG_LEVEL environment variable - Export TypeScript types for better IDE support This provides consistent, structured logging across all applications and packages, making debugging easier and production logs more parseable.
This commit is contained in:
parent
5b89bfce7c
commit
c1feaa4cb1
42 changed files with 3824 additions and 2422 deletions
|
|
@ -1,12 +1,14 @@
|
|||
import { run } from "graphile-worker";
|
||||
import { createLogger } from "@link-stack/logger";
|
||||
import * as path from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
const logger = createLogger('bridge-worker');
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
const startWorker = async () => {
|
||||
console.info("Starting worker...");
|
||||
logger.info("Starting worker...");
|
||||
|
||||
await run({
|
||||
connectionString: process.env.DATABASE_URL,
|
||||
|
|
@ -30,6 +32,6 @@ const main = async () => {
|
|||
};
|
||||
|
||||
main().catch((err) => {
|
||||
console.error(err);
|
||||
logger.error({ error: err }, 'Worker failed to start');
|
||||
process.exit(1);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue