hey log works at least

main
Ethan Niser 2023-09-18 11:27:09 -05:00
parent 5bada378be
commit a758749ca9
2 changed files with 32 additions and 31 deletions

@ -1,6 +1,6 @@
import { logger } from "@bogeychan/elysia-logger";
import { Elysia } from "elysia";
// import { logger } from "@bogeychan/elysia-logger";
// import pretty from "pino-pretty";
import pretty from "pino-pretty";
import { config } from "../config";
import { client, db } from "../db";
import "beth-stack/jsx/register";
@ -9,25 +9,25 @@ import { auth } from "../auth";
// import { cron } from "@elysiajs/cron";
// const stream = pretty({
// colorize: true,
// });
const stream = pretty({
colorize: true,
});
export const ctx = new Elysia({
name: "@app/ctx",
})
.use(
bethStack({
log: true,
// log: false,
returnStaleWhileRevalidate: false,
}),
)
// .use(
// logger({
// level: config.env.LOG_LEVEL,
// stream,
// })
// )
.use(
logger({
level: config.env.LOG_LEVEL,
stream,
}),
);
// .use(
// cron({
// name: "heartbeat",
@ -43,9 +43,9 @@ export const ctx = new Elysia({
// },
// })
// )
.decorate("db", db)
.decorate("config", config)
.decorate("auth", auth);
// .decorate("db", db)
// .decorate("config", config)
// .decorate("auth", auth)
// .onStart(({ log }) => log.info("Server starting"))
// .onStop(({ log }) => log.info("Server stopping"))
// .onRequest(({ log, request }) => {

@ -30,7 +30,8 @@ export const index = new Elysia()
});
}
})
.get("/test", async ({ html }) => {
.get("/test", async ({ html, log }) => {
log.info("test");
const time = await cachedGetTime();
return html(() => <p>{time}</p>);
})