File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
packages/next/src/server/dev/browser-logs Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ export interface LogEntry {
8
8
message : string
9
9
}
10
10
11
+ // Logging server and browser logs to a file
11
12
export class FileLogger {
12
13
private logFilePath : string = ''
13
14
private isInitialized : boolean = false
@@ -29,12 +30,10 @@ export class FileLogger {
29
30
}
30
31
31
32
try {
32
- // Create the log file if it doesn't exist
33
- if ( ! fs . existsSync ( this . logFilePath ) ) {
34
- // ensure the directory exists
35
- fs . mkdirSync ( path . dirname ( this . logFilePath ) , { recursive : true } )
36
- fs . writeFileSync ( this . logFilePath , '' )
37
- }
33
+ // Clean up the log file on each initialization
34
+ // ensure the directory exists
35
+ fs . mkdirSync ( path . dirname ( this . logFilePath ) , { recursive : true } )
36
+ fs . writeFileSync ( this . logFilePath , '' )
38
37
this . isInitialized = true
39
38
} catch ( error ) {
40
39
console . error ( error )
You can’t perform that action at this time.
0 commit comments