feat(monitoring): change logger to pino

This changes the logger used to be pino, which print the logs on a single line per log event
This commit is contained in:
Maix0 2025-12-17 19:42:33 +01:00
parent 8a3481ea8b
commit 9b24bd0c41
8 changed files with 16 additions and 64 deletions

View file

@ -28,8 +28,10 @@ export const useDatabase = fp<FastifyPluginAsync>(async function(
if (dbAdded) { return; }
dbAdded = true;
const path = process.env.DATABASE_DIR;
if (isNullish(path)) { throw 'env `DATABASE_DIR` not defined'; }
f.log.info(`Opening database with path: ${path}/database.db`);
if (isNullish(path)) {
f.log.fatal('env `DATABASE_DIR` not defined');
throw 'env `DATABASE_DIR` not defined';
}
const db: Database = new DbImpl(`${path}/database.db`) as Database;
if (!f.hasDecorator('db')) { f.decorate('db', db); }
});

View file

@ -11,7 +11,7 @@ import { FastifyReply } from 'fastify';
import fp from 'fastify-plugin';
export const useMonitoring = fp(async (fastify) => {
fastify.get('/monitoring', { schema: { hide: true } }, (req, res) => {
fastify.get('/monitoring', { schema: { hide: true }, logLevel: 'silent' }, (req, res) => {
void req;
res.code(200).send('Ok');
});