chore: use monorepo organization

This commit is contained in:
Rafael Taranto 2025-05-12 10:52:54 +01:00
parent deaf7d6ecc
commit a687827f7e
1099 changed files with 8184 additions and 11535 deletions

View file

@ -0,0 +1,46 @@
const winston = require('winston')
const Postgres = require('./pg-transport')
const { PSQL_URL } = require('./constants')
const LOG_LEVEL = process.env.LOG_LEVEL
const logger = new winston.Logger({
level: LOG_LEVEL,
transports: [
new (winston.transports.Console)({
timestamp: true,
colorize: true,
handleExceptions: true,
humanReadableUnhandledException: true
}),
new Postgres({
connectionString: PSQL_URL,
tableName: 'server_logs',
handleExceptions: true,
humanReadableUnhandledException: true
})
],
rewriters: [
(...[,, meta]) => {
if (meta.isAxiosError) {
return {
message: meta.message,
status: meta.response?.status,
data: meta.response?.data,
url: meta.config?.url,
method: meta.config?.method
}
}
return meta instanceof Error ? { message: meta.message, stack: meta.stack, meta } : meta
}
],
exitOnError: false
})
logger.stream = {
write: message => {
logger.info(message.trim())
}
}
module.exports = logger