refactor(biome): formats from biome
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
import {
|
import {
|
||||||
text,
|
|
||||||
pgTable,
|
|
||||||
timestamp,
|
|
||||||
uuid,
|
|
||||||
uniqueIndex,
|
|
||||||
jsonb,
|
|
||||||
boolean,
|
boolean,
|
||||||
|
jsonb,
|
||||||
|
pgTable,
|
||||||
|
text,
|
||||||
|
timestamp,
|
||||||
|
uniqueIndex,
|
||||||
|
uuid,
|
||||||
} from "drizzle-orm/pg-core";
|
} from "drizzle-orm/pg-core";
|
||||||
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
|
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ export const settings = pgTable(
|
|||||||
(table) => [
|
(table) => [
|
||||||
// uniqueIndex('emailUniqueIndex').on(sql`lower(${table.email})`),
|
// uniqueIndex('emailUniqueIndex').on(sql`lower(${table.email})`),
|
||||||
uniqueIndex("name").on(table.name),
|
uniqueIndex("name").on(table.name),
|
||||||
]
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
export const settingSchema = createSelectSchema(settings);
|
export const settingSchema = createSelectSchema(settings);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import build from "pino-abstract-transport";
|
import build from "pino-abstract-transport";
|
||||||
import { db } from "../db/db.js";
|
import { db } from "../db/db.js";
|
||||||
import { logs, type Log } from "../db/schema/logs.js";
|
import { type Log, logs } from "../db/schema/logs.js";
|
||||||
import { tryCatch } from "../utils/tryCatch.js";
|
import { tryCatch } from "../utils/tryCatch.js";
|
||||||
|
|
||||||
const pinoLogLevels: any = {
|
const pinoLogLevels: any = {
|
||||||
@@ -15,8 +15,8 @@ const pinoLogLevels: any = {
|
|||||||
export default async function (log: Log) {
|
export default async function (log: Log) {
|
||||||
//const {username, service, level, msg, ...extra} = log;
|
//const {username, service, level, msg, ...extra} = log;
|
||||||
try {
|
try {
|
||||||
return build(async function (source) {
|
return build(async (source) => {
|
||||||
for await (let obj of source) {
|
for await (const obj of source) {
|
||||||
// convert to the name to make it more easy to find later :P
|
// convert to the name to make it more easy to find later :P
|
||||||
const levelName = pinoLogLevels[obj.level] || "unknown";
|
const levelName = pinoLogLevels[obj.level] || "unknown";
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ export default async function (log: Log) {
|
|||||||
hostname: obj?.hostname?.toLowerCase(),
|
hostname: obj?.hostname?.toLowerCase(),
|
||||||
message: obj.msg,
|
message: obj.msg,
|
||||||
stack: obj?.stack,
|
stack: obj?.stack,
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import pino, { type Logger } from "pino";
|
import pino, { type Logger } from "pino";
|
||||||
|
|
||||||
export let logLevel = process.env.LOG_LEVEL || "info";
|
export const logLevel = process.env.LOG_LEVEL || "info";
|
||||||
|
|
||||||
const transport = pino.transport({
|
const transport = pino.transport({
|
||||||
targets: [
|
targets: [
|
||||||
@@ -37,7 +37,7 @@ export const rootLogger: Logger = pino(
|
|||||||
level: logLevel,
|
level: logLevel,
|
||||||
redact: { paths: ["email", "password"], remove: true },
|
redact: { paths: ["email", "password"], remove: true },
|
||||||
},
|
},
|
||||||
transport
|
transport,
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import build from "pino-abstract-transport";
|
import build from "pino-abstract-transport";
|
||||||
import { type Log } from "../db/schema/logs.js";
|
import type { Log } from "../db/schema/logs.js";
|
||||||
import { validateEnv } from "../utils/envValidator.js";
|
import { validateEnv } from "../utils/envValidator.js";
|
||||||
import { sendNotify } from "../utils/notify.js";
|
import { sendNotify } from "../utils/notify.js";
|
||||||
|
|
||||||
const env = validateEnv(process.env);
|
const env = validateEnv(process.env);
|
||||||
|
|
||||||
const pinoLogLevels: any = {
|
const pinoLogLevels: any = {
|
||||||
@@ -17,16 +18,14 @@ const pinoLogLevels: any = {
|
|||||||
export default async function (log: Log) {
|
export default async function (log: Log) {
|
||||||
//const {username, service, level, msg, ...extra} = log;
|
//const {username, service, level, msg, ...extra} = log;
|
||||||
try {
|
try {
|
||||||
return build(async function (source) {
|
return build(async (source) => {
|
||||||
for await (let obj of source) {
|
for await (const obj of source) {
|
||||||
// convert to the name to make it more easy to find later :P
|
// convert to the name to make it more easy to find later :P
|
||||||
const levelName = pinoLogLevels[obj.level] || "unknown";
|
const levelName = pinoLogLevels[obj.level] || "unknown";
|
||||||
|
|
||||||
const newlog = {
|
const newlog = {
|
||||||
level: levelName,
|
level: levelName,
|
||||||
module: obj.module
|
module: obj.module ? String(obj.module).toLowerCase() : undefined,
|
||||||
? String(obj.module).toLowerCase()
|
|
||||||
: undefined,
|
|
||||||
subModule: obj.subModule
|
subModule: obj.subModule
|
||||||
? String(obj.subModule).toLowerCase()
|
? String(obj.subModule).toLowerCase()
|
||||||
: undefined,
|
: undefined,
|
||||||
|
|||||||
Reference in New Issue
Block a user