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
|
|
@ -4,9 +4,12 @@ import { promises as fs } from "fs";
|
|||
import { glob } from "glob";
|
||||
import path from "path";
|
||||
import os from "os";
|
||||
import { createLogger } from "@link-stack/logger";
|
||||
|
||||
const logger = createLogger('zammad-addon-build');
|
||||
|
||||
const packageFile = async (actualPath: string): Promise<any> => {
|
||||
console.info(`Packaging: ${actualPath}`);
|
||||
logger.info({ actualPath }, 'Packaging file');
|
||||
const packagePath = actualPath.slice(4);
|
||||
const data = await fs.readFile(actualPath, "utf-8");
|
||||
const content = Buffer.from(data, "utf-8").toString("base64");
|
||||
|
|
@ -74,10 +77,10 @@ export const createZPM = async ({
|
|||
|
||||
for (const file of files) {
|
||||
await fs.unlink(file);
|
||||
console.info(`${file} was deleted`);
|
||||
logger.info({ file }, 'File was deleted');
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
logger.error({ error: err }, 'Error removing old addon files');
|
||||
}
|
||||
await fs.writeFile(
|
||||
`../../docker/zammad/addons/${name}-v${version}.zpm`,
|
||||
|
|
@ -89,7 +92,7 @@ export const createZPM = async ({
|
|||
const main = async () => {
|
||||
const packageJSON = JSON.parse(await fs.readFile("./package.json", "utf-8"));
|
||||
const { name: fullName, displayName, version } = packageJSON;
|
||||
console.info(`Building addon ${displayName} v${version}`);
|
||||
logger.info({ displayName, version }, 'Building addon');
|
||||
const name = fullName.split("/").pop();
|
||||
await createZPM({ name, displayName, version });
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue