🔄 Synchronize Biome linting rules between relay and frontend

🛠️ Apply identical Biome configuration from frontend to relay service
🧹 Ensure consistent code formatting and quality standards across components
📝 Maintain unified development experience throughout the project
This commit is contained in:
Danny Morabito 2025-03-24 19:20:24 +01:00
parent 4bd0839669
commit a4134fa416
Signed by: dannym
GPG key ID: 7CC8056A5A04557E
9 changed files with 273 additions and 195 deletions

View file

@ -1,59 +1,59 @@
import * as colors from "jsr:@std/fmt@^1.0.4/colors";
import * as log from "jsr:@std/log";
import { getEveFilePath } from "./files.ts";
export * as log from "jsr:@std/log";
import * as colors from 'jsr:@std/fmt@^1.0.4/colors';
import * as log from 'jsr:@std/log';
import { getEveFilePath } from './files.ts';
export * as log from 'jsr:@std/log';
export async function setupLogger() {
const formatLevel = (level: number): string => {
return (
{
10: colors.gray("[DEBUG]"),
20: colors.green("[INFO] "),
30: colors.yellow("[WARN] "),
40: colors.red("[ERROR]"),
50: colors.bgRed("[FATAL]"),
10: colors.gray('[DEBUG]'),
20: colors.green('[INFO] '),
30: colors.yellow('[WARN] '),
40: colors.red('[ERROR]'),
50: colors.bgRed('[FATAL]'),
}[level] || `[LVL${level}]`
);
};
const levelName = (level: number): string => {
return {
10: "DEBUG",
20: "INFO",
30: "WARN",
40: "ERROR",
50: "FATAL",
}[level] || `LVL${level}`;
return (
{
10: 'DEBUG',
20: 'INFO',
30: 'WARN',
40: 'ERROR',
50: 'FATAL',
}[level] || `LVL${level}`
);
};
const formatArg = (arg: unknown): string => {
if (typeof arg === "object") return JSON.stringify(arg);
if (typeof arg === 'object') return JSON.stringify(arg);
return String(arg);
};
await log.setup({
handlers: {
console: new log.ConsoleHandler("DEBUG", {
console: new log.ConsoleHandler('DEBUG', {
useColors: true,
formatter: (record) => {
const timestamp = new Date().toISOString();
let msg = `${colors.dim(`[${timestamp}]`)} ${
formatLevel(record.level)
} ${record.msg}`;
let msg = `${colors.dim(`[${timestamp}]`)} ${formatLevel(record.level)} ${record.msg}`;
if (record.args.length > 0) {
const args = record.args
.map((arg, i) => `${colors.dim(`arg${i}:`)} ${formatArg(arg)}`)
.join(" ");
msg += ` ${colors.dim("|")} ${args}`;
.join(' ');
msg += ` ${colors.dim('|')} ${args}`;
}
return msg;
},
}),
file: new log.FileHandler("DEBUG", {
filename: Deno.env.get("LOG_FILE") ||
await getEveFilePath("eve-logs.jsonl"),
file: new log.FileHandler('DEBUG', {
filename:
Deno.env.get('LOG_FILE') || (await getEveFilePath('eve-logs.jsonl')),
formatter: (record) => {
const timestamp = new Date().toISOString();
return JSON.stringify({
@ -67,8 +67,8 @@ export async function setupLogger() {
},
loggers: {
default: {
level: "DEBUG",
handlers: ["console", "file"],
level: 'DEBUG',
handlers: ['console', 'file'],
},
},
});