@@ -4,7 +4,7 @@ title: logger
44
55<Intro >
66
7- The ` logger ` option provides custom logging for React Compiler events during compilation.
7+ ` logger ` 选项在编译期间为 React 编译器事件提供自定义日志记录。
88
99</Intro >
1010
@@ -22,49 +22,52 @@ The `logger` option provides custom logging for React Compiler events during com
2222
2323---
2424
25- ## Reference {/* reference* /}
25+ ## 参考 {/* reference* /}
26+
2627
2728### ` logger ` {/* logger* /}
2829
29- Configures custom logging to track compiler behavior and debug issues.
30+ 配置自定义日志以跟踪编译器行为并调试问题。
3031
31- #### Type {/* type* /}
32+ #### 类型 {/* type* /}
3233
3334```
3435{
3536 logEvent: (filename: string | null, event: LoggerEvent) => void;
3637} | null
3738```
3839
39- #### Default value {/* default-value* /}
40+ #### 默认值 {/* default-value* /}
4041
4142` null `
4243
43- #### Methods {/* methods* /}
44+ #### 方法 {/* methods* /}
45+
46+ - ** ` logEvent ` ** :传入文件名和事件详情来记录每次编译器事件
4447
45- - ** ` logEvent ` ** : Called for each compiler event with the filename and event details
48+ #### 事件类型 {/ * event-types * /}
4649
47- #### Event types {/* event-types* /}
50+ - ** ` CompileSuccess ` ** :函数成功编译
51+ - ** ` CompileError ` ** : 由于错误而跳过该函数
52+ - ** ` CompileDiagnostic ` ** :非致命的诊断信息
53+ - ** ` CompileSkip ` ** : 因其他原因跳过该函数
54+ - ** ` PipelineError ` ** : 意外的编译管线错误
55+ - ** ` Timing ` ** :性能计时信息
4856
49- - ** ` CompileSuccess ` ** : Function successfully compiled
50- - ** ` CompileError ` ** : Function skipped due to errors
51- - ** ` CompileDiagnostic ` ** : Non-fatal diagnostic information
52- - ** ` CompileSkip ` ** : Function skipped for other reasons
53- - ** ` PipelineError ` ** : Unexpected compilation error
54- - ** ` Timing ` ** : Performance timing information
5557
56- #### Caveats {/* caveats* /}
58+ #### 注意事项 {/* caveats* /}
5759
58- - Event structure may change between versions
59- - Large codebases generate many log entries
60+ - 事件结构可能在不同版本之间发生变化
61+ - 大型代码库会生成大量日志条目
6062
6163---
6264
63- ## Usage {/* usage* /}
65+ ## 用法 {/* usage* /}
6466
65- ### Basic logging {/* basic-logging* /}
6667
67- Track compilation success and failures:
68+ ### 基础日志 {/* basic-logging* /}
69+
70+ 跟踪编译成功和失败:
6871
6972``` js
7073{
@@ -86,9 +89,9 @@ Track compilation success and failures:
8689}
8790```
8891
89- ### Detailed error logging {/* detailed-error-logging* /}
92+ ### 详细错误日志 {/* detailed-error-logging* /}
9093
91- Get specific information about compilation failures:
94+ 获取编译失败的具体信息:
9295
9396``` js
9497{
@@ -115,4 +118,3 @@ Get specific information about compilation failures:
115118 }
116119}
117120```
118-
0 commit comments