feat(logging): report important keyboard events
This commit is contained in:
+13
-3
@@ -79,6 +79,11 @@ 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
|
||||
@@ -146,8 +151,11 @@ export class Logger {
|
||||
}
|
||||
|
||||
private write(level: LogLevel, args: LogArgs): void {
|
||||
Logger.reportImportantProductionLog(level, this.component, args);
|
||||
Logger.reportProductionLog(level, this.component, args);
|
||||
this.writeLocal(level, args);
|
||||
}
|
||||
|
||||
private writeLocal(level: LogLevel, args: LogArgs): void {
|
||||
if (Logger.shouldUseBrowserConsole()) {
|
||||
Logger.writeBrowserConsole(level, this.component, args);
|
||||
return;
|
||||
@@ -184,12 +192,14 @@ export class Logger {
|
||||
);
|
||||
}
|
||||
|
||||
private static reportImportantProductionLog(
|
||||
private static reportProductionLog(
|
||||
level: LogLevel,
|
||||
component: string,
|
||||
args: LogArgs,
|
||||
force = false,
|
||||
): void {
|
||||
if (!Logger.shouldReportToRemote(level)) return;
|
||||
if (!force && !Logger.shouldReportToRemote(level)) return;
|
||||
if (force && !AppEnvUtil.isProduction()) return;
|
||||
|
||||
const { message, data } = Logger.toBrowserConsolePayload(args);
|
||||
reportSentryLog({
|
||||
|
||||
Reference in New Issue
Block a user