File tree Expand file tree Collapse file tree 4 files changed +17
-5
lines changed
Expand file tree Collapse file tree 4 files changed +17
-5
lines changed Original file line number Diff line number Diff line change 1717 "@elysiajs/cors" : " ^1.3.3" ,
1818 "@elysiajs/trpc" : " ^1.1.0" ,
1919 "@elysiajs/websocket" : " ^0.2.8" ,
20+ "@logtail/edge" : " ^0.5.5" ,
2021 "@trpc/server" : " ^11.4.3" ,
2122 "autumn-js" : " 0.0.101-beta.1" ,
2223 "dayjs" : " ^1.11.13" ,
Original file line number Diff line number Diff line change 1+ import { Logtail } from '@logtail/edge' ;
2+
3+ const token = process . env . LOGTAIL_SOURCE_TOKEN as string ;
4+ const endpoint = process . env . LOGTAIL_ENDPOINT as string ;
5+ export const logger = new Logtail ( token , {
6+ endpoint,
7+ batchSize : 10 ,
8+ batchInterval : 1000 ,
9+ } ) ;
Original file line number Diff line number Diff line change 11import { chQuery , db } from '@databuddy/db' ;
2- import { redis } from '@databuddy/redis' ;
2+ import { redis as redisClient } from '@databuddy/redis' ;
33import { Elysia } from 'elysia' ;
4+ import { logger } from '../lib/logger' ;
45
56const checkClickhouse = async ( ) => {
67 try {
78 const result = await chQuery ( 'SELECT 1 FROM analytics.events LIMIT 1' ) ;
89 return result . length > 0 ;
910 } catch ( error ) {
10- console . error ( 'ClickHouse health check failed:' , error ) ;
11+ logger . error ( 'ClickHouse health check failed:' , { error } ) ;
1112 return false ;
1213 }
1314} ;
@@ -19,17 +20,17 @@ const checkDatabase = async () => {
1920 } ) ;
2021 return result . length > 0 ;
2122 } catch ( error ) {
22- console . error ( 'Database health check failed:' , error ) ;
23+ logger . error ( 'Database health check failed:' , { error } ) ;
2324 return false ;
2425 }
2526} ;
2627
2728const checkRedis = async ( ) => {
2829 try {
29- const result = await redis . ping ( ) ;
30+ const result = await redisClient . ping ( ) ;
3031 return result === 'PONG' ;
3132 } catch ( error ) {
32- console . error ( 'Redis health check failed:' , error ) ;
33+ logger . error ( 'Redis health check failed:' , { error } ) ;
3334 return false ;
3435 }
3536} ;
Original file line number Diff line number Diff line change 1919 "@elysiajs/cors" : " ^1.3.3" ,
2020 "@elysiajs/trpc" : " ^1.1.0" ,
2121 "@elysiajs/websocket" : " ^0.2.8" ,
22+ "@logtail/edge" : " ^0.5.5" ,
2223 "@trpc/server" : " ^11.4.3" ,
2324 "autumn-js" : " 0.0.101-beta.1" ,
2425 "dayjs" : " ^1.11.13" ,
You can’t perform that action at this time.
0 commit comments