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