Skip to content

Commit

Permalink
Merge pull request #52 from dotslashf/development
Browse files Browse the repository at this point in the history
Self Service Umami Analytics
  • Loading branch information
dotslashf authored Sep 5, 2024
2 parents 93ca8af + 33936a3 commit 4fb55f0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ export default function RootLayout({
{!isDevelopment && (
<Script
defer
src="https://cloud.umami.is/script.js"
data-website-id="08afa8e8-cecd-4188-ba68-cdfad14f7294"
src="https://umami-arsip-template.koyeb.app/script.js"
data-website-id="3d005c97-2e3d-4e52-be52-bf933e5b6efd"
/>
)}
<meta
Expand Down
2 changes: 1 addition & 1 deletion src/server/api/trpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
defaultFingerPrint,
} from "@trpc-limiter/redis";
import { type NextRequest } from "next/server";
import { logTRPCRequest } from "../middleware";
import { logTRPCRequest } from "../middleware/logger";

export const redis = createClient({
password: env.REDIS_PASSWORD,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export function logTRPCRequest({
errorMessage = result instanceof TRPCError ? result.message : "",
userAgent = ctx.req?.headers.get("user-agent") ?? "Unknown",
method = ctx.req?.method ?? "Unknown";

if (userAgent === "node") return;
console.log(
`${chalk.bgBlueBright.black(" TRPC ")} ${chalk.grey(timestamp)} | 🛣️ ${chalk.cyan(path)} | 🛠️ ${chalk.cyan(type)} | 🚨 ${chalk.cyan(method)} | ⏱️ ${chalk.cyan(`${duration}ms`)} | 👤 ${chalk.magenta(userId)} | ${status === "error" ? "❌" : "✅"} ${status === "error" ? chalk.red(status) : chalk.green(status)}${errorMessage ? ` | 🛑 ${chalk.red(errorMessage)}` : ""} | 🖥️ ${chalk.grey(userAgent)} | 🔍 ${chalk.grey(JSON.stringify(input ?? null).slice(0, 100))}`,
);
Expand Down

0 comments on commit 4fb55f0

Please sign in to comment.