feat: add real time logger page (#276)
* feat: add real time logger * feat: add subscription for logging * feat: use timestamp and level in xterm, migrate to new xterm package * feat: improve design on log page * fit: remove xterm fit addon * fix: dispose terminal correctly * style: format code * refactor: add jsdoc for redis-transport * fix: redis connection not possible sometimes * feat: make terminal full size * fix: deepsource issues * fix: lint issue --------- Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
This commit is contained in:
18
packages/api/src/router/log.ts
Normal file
18
packages/api/src/router/log.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { observable } from "@trpc/server/observable";
|
||||
|
||||
import { logger } from "@homarr/log";
|
||||
import type { LoggerMessage } from "@homarr/redis";
|
||||
import { loggingChannel } from "@homarr/redis";
|
||||
|
||||
import { createTRPCRouter, publicProcedure } from "../trpc";
|
||||
|
||||
export const logRouter = createTRPCRouter({
|
||||
subscribe: publicProcedure.subscription(() => {
|
||||
return observable<LoggerMessage>((emit) => {
|
||||
loggingChannel.subscribe((data) => {
|
||||
emit.next(data);
|
||||
});
|
||||
logger.info("A tRPC client has connected to the logging procedure");
|
||||
});
|
||||
}),
|
||||
});
|
||||
Reference in New Issue
Block a user