Strip all PostHog and Sentry telemetry from the codebase so the product works without phoning home. OpenTelemetry (CLI, user-configured) is kept. - Delete core telemetry files (posthog.ts, SentryLogger, TeamAnalytics, TokensBatchingService) - Remove all capture/report calls from 80+ caller files across core, GUI, VSCode, CLI, IntelliJ - Remove posthog-node, posthog-js, @sentry/* dependencies from all package.json files - Remove PostHog/Sentry plugins and build scripts - Create IdeInfoService.ts and uniqueId.ts for non-telemetry request headers - Remove PostHog API key from docs config - Remove posthog from analytics provider config schema Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
77 lines
2 KiB
TypeScript
77 lines
2 KiB
TypeScript
import winston from "winston";
|
|
|
|
class LoggerClass {
|
|
private static instance: LoggerClass;
|
|
private winston: winston.Logger;
|
|
|
|
private constructor() {
|
|
this.winston = winston.createLogger({
|
|
level: "info",
|
|
format: winston.format.combine(
|
|
winston.format.colorize(),
|
|
winston.format.timestamp(),
|
|
winston.format.printf(({ level, message, timestamp, ...meta }) => {
|
|
const metaStr = Object.keys(meta).length
|
|
? ` ${JSON.stringify(meta)}`
|
|
: "";
|
|
return `[@continuedev] ${level}: ${message}${metaStr}`;
|
|
}),
|
|
),
|
|
transports: [
|
|
// Write all logs with importance level of `info` or higher to `info.log`
|
|
...(process.env.NODE_ENV === "test"
|
|
? [
|
|
new winston.transports.File({
|
|
filename: "e2e.log",
|
|
level: "info",
|
|
}),
|
|
]
|
|
: []),
|
|
// Normal console.log behavior
|
|
new winston.transports.Console(),
|
|
],
|
|
});
|
|
}
|
|
|
|
public static getInstance(): LoggerClass {
|
|
if (!LoggerClass.instance) {
|
|
LoggerClass.instance = new LoggerClass();
|
|
}
|
|
return LoggerClass.instance;
|
|
}
|
|
|
|
public log(message: string, meta?: any): void {
|
|
this.winston.info(message, meta);
|
|
}
|
|
|
|
public debug(message: string, meta?: any): void {
|
|
this.winston.debug(message, meta);
|
|
}
|
|
|
|
public info(message: string, meta?: any): void {
|
|
this.winston.info(message, meta);
|
|
}
|
|
|
|
public warn(message: string, meta?: any): void {
|
|
this.winston.warn(message, meta);
|
|
}
|
|
|
|
public error(
|
|
error: Error | string | unknown,
|
|
context?: Record<string, any>,
|
|
): void {
|
|
let errorMessage: string;
|
|
|
|
if (error instanceof Error) {
|
|
errorMessage = error.message;
|
|
} else if (typeof error === "string") {
|
|
errorMessage = error;
|
|
} else {
|
|
errorMessage = "An unknown error occurred";
|
|
}
|
|
|
|
this.winston.error(errorMessage, context);
|
|
}
|
|
}
|
|
|
|
export const Logger = LoggerClass.getInstance();
|