@@ -44,28 +44,37 @@ export function logSetup() {
4444
4545 // Log to file
4646 // Only log to file if firebase.debug extension setting is true.
47- // Re-implement file logger call from ../../src/bin/firebase.ts to not bring
48- // in the entire firebase.ts file
49- const rootFolders = getRootFolders ( ) ;
50- // Default to a central path, but write files to a local path if we're in a Firebase directory.
51- let filePath = path . join ( os . homedir ( ) , ".cache" , "firebase" , "logs" , "vsce-debug.log" ) ;
52- if ( fs . existsSync ( path . join ( rootFolders [ 0 ] , "firebase.json" ) ) ) {
53- filePath = path . join ( rootFolders [ 0 ] , ".firebase" , "logs" , "vsce-debug.log" ) ;
54- }
55- pluginLogger . info ( "Logging to path" , filePath ) ;
56- cliLogger . add (
57- new transports . File ( {
58- level : "debug" ,
59- filename : filePath ,
60- format : format . printf ( ( info ) => {
61- const segments = [ info . message , ...( info [ SPLAT ] || [ ] ) ] . map (
62- tryStringify ,
63- ) ;
64- return `[${ info . level } ] ${ stripVTControlCharacters ( segments . join ( " " ) ) } ` ;
65- } ) ,
47+ // Re-implement file logger call from ../../src/bin/firebase.ts to not bring
48+ // in the entire firebase.ts file
49+ const rootFolders = getRootFolders ( ) ;
50+ // Default to a central path, but write files to a local path if we're in a Firebase directory.
51+ let filePath = path . join (
52+ os . homedir ( ) ,
53+ ".cache" ,
54+ "firebase" ,
55+ "logs" ,
56+ "vsce-debug.log" ,
57+ ) ;
58+ if (
59+ rootFolders . length > 0 &&
60+ fs . existsSync ( path . join ( rootFolders [ 0 ] , "firebase.json" ) )
61+ ) {
62+ filePath = path . join ( rootFolders [ 0 ] , ".firebase" , "logs" , "vsce-debug.log" ) ;
63+ }
64+ pluginLogger . info ( "Logging to path" , filePath ) ;
65+ cliLogger . add (
66+ new transports . File ( {
67+ level : "debug" ,
68+ filename : filePath ,
69+ format : format . printf ( ( info ) => {
70+ const segments = [ info . message , ...( info [ SPLAT ] || [ ] ) ] . map (
71+ tryStringify ,
72+ ) ;
73+ return `[${ info . level } ] ${ stripVTControlCharacters ( segments . join ( " " ) ) } ` ;
6674 } ) ,
67- ) ;
68- cliLogger . add ( new VSCodeOutputTransport ( { level : "info" } ) ) ;
75+ } ) ,
76+ ) ;
77+ cliLogger . add ( new VSCodeOutputTransport ( { level : "info" } ) ) ;
6978}
7079
7180/**
0 commit comments