Revert "feat(logging): report important keyboard events"

This reverts commit b59da8f7e4.
This commit is contained in:
2026-07-02 17:17:10 +08:00
parent e052381b77
commit efd89de0b0
4 changed files with 12 additions and 49 deletions
+2 -25
View File
@@ -31,12 +31,6 @@ export function ChatInputBar({ disabled = false }: ChatInputBarProps) {
containerRef: barRef,
active: isFocused,
onKeyboardDismiss: () => {
log.important("info", "[chat-input-bar] keyboard dismissed", {
contentLength: input.length,
hasContent,
disabled,
wasFocused: isFocused,
});
setIsFocused(false);
},
});
@@ -45,21 +39,11 @@ export function ChatInputBar({ disabled = false }: ChatInputBarProps) {
setInput(value);
};
const handleFocusChange = (focused: boolean) => {
log.important("info", "[chat-input-bar] focus change", {
focused,
contentLength: input.length,
hasContent,
disabled,
});
setIsFocused(focused);
};
const handleSend = (source: "click" | "keyboard" | "pointerdown") => {
if (source === "click") {
const elapsed = Date.now() - lastPointerSendAtRef.current;
if (elapsed >= 0 && elapsed < POINTER_SEND_CLICK_DEDUPE_MS) {
log.important("info", "[chat-input-bar] suppress duplicate click", {
log.debug("[chat-input-bar] suppress duplicate click", {
elapsed,
contentLength: input.length,
hasContent,
@@ -78,13 +62,6 @@ export function ChatInputBar({ disabled = false }: ChatInputBarProps) {
disabled,
isFocused,
});
log.important("info", "[chat-input-bar] send", {
source,
contentLength: input.length,
hasContent,
disabled,
isFocused,
});
dispatch({ type: "ChatSendMessage", content: input });
setInput("");
textareaRef.current?.focus();
@@ -106,7 +83,7 @@ export function ChatInputBar({ disabled = false }: ChatInputBarProps) {
value={input}
onChange={handleInputChange}
onSubmit={() => handleSend("keyboard")}
onFocusChange={handleFocusChange}
onFocusChange={setIsFocused}
disabled={disabled}
/>
<ChatSendButton
+6 -10
View File
@@ -67,14 +67,10 @@ export function useKeyboardHeight({
const environment = getKeyboardAdaptEnvironment();
if (!shouldEnableKeyboardAdaptation(environment)) {
resetInputLiftVar();
const payload = {
log.debug("[keyboard] disabled", {
reason: "not-android-facebook-fallback-device",
environment,
};
log.debug("[keyboard] disabled", payload);
if (environment.isAndroid && environment.isFacebookInAppBrowser) {
log.important("info", "[keyboard] disabled", payload);
}
});
return;
}
@@ -86,7 +82,7 @@ export function useKeyboardHeight({
let lastInputLift = -1;
const focusedAt = active ? performance.now() : 0;
log.important("info", "[keyboard] environment", environment);
log.debug("[keyboard] environment", environment);
const clearTimers = () => {
timeoutIds.forEach((id) => window.clearTimeout(id));
@@ -103,7 +99,7 @@ export function useKeyboardHeight({
lastInputLift = nextLift;
setInputLiftVar(nextLift);
log.important("info", "[keyboard] apply", {
log.debug("[keyboard] apply", {
reason,
inputLift: nextLift,
fallback: nextLift === FALLBACK_INPUT_LIFT_PX,
@@ -118,7 +114,7 @@ export function useKeyboardHeight({
applyLift(0, reason);
blurKeyboardTarget(targetRef?.current);
onKeyboardDismissRef.current?.();
log.important("info", "[keyboard] released", {
log.debug("[keyboard] released", {
reason,
snapshot: formatSnapshot(readKeyboardSnapshot()),
});
@@ -175,7 +171,7 @@ export function useKeyboardHeight({
const target = targetRef?.current;
const container = containerRef?.current;
if (event.target instanceof Node && container?.contains(event.target)) {
log.important("info", "[keyboard] keep active for input container tap", {
log.debug("[keyboard] keep active for input container tap", {
snapshot: formatSnapshot(readKeyboardSnapshot()),
});
return;
+1 -1
View File
@@ -1,7 +1,7 @@
import * as Sentry from "@sentry/nextjs";
import type { CaptureContext, SeverityLevel } from "@sentry/nextjs";
export type RemoteLogLevel = "debug" | "info" | "warn" | "error" | "fatal";
export type RemoteLogLevel = "warn" | "error" | "fatal";
export interface SentryLogPayload {
level: RemoteLogLevel;
+3 -13
View File
@@ -79,11 +79,6 @@ export class Logger {
this.write("fatal", args);
}
important(level: RemoteLogLevel, ...args: LogArgs): void {
Logger.reportProductionLog(level, this.component, args, true);
this.writeLocal(level, args);
}
/**
* 把日志中的任意数据转成人眼友好的多行文本。
* - object / array: pretty JSON
@@ -151,11 +146,8 @@ export class Logger {
}
private write(level: LogLevel, args: LogArgs): void {
Logger.reportProductionLog(level, this.component, args);
this.writeLocal(level, args);
}
Logger.reportImportantProductionLog(level, this.component, args);
private writeLocal(level: LogLevel, args: LogArgs): void {
if (Logger.shouldUseBrowserConsole()) {
Logger.writeBrowserConsole(level, this.component, args);
return;
@@ -192,14 +184,12 @@ export class Logger {
);
}
private static reportProductionLog(
private static reportImportantProductionLog(
level: LogLevel,
component: string,
args: LogArgs,
force = false,
): void {
if (!force && !Logger.shouldReportToRemote(level)) return;
if (force && !AppEnvUtil.isProduction()) return;
if (!Logger.shouldReportToRemote(level)) return;
const { message, data } = Logger.toBrowserConsolePayload(args);
reportSentryLog({