()
| 36 | * Logging setup for logging to console and to file. |
| 37 | */ |
| 38 | export function logSetup() { |
| 39 | // Log to console (use built in CLI functionality) |
| 40 | process.env.DEBUG = "true"; |
| 41 | useConsoleLoggers(); |
| 42 | |
| 43 | // Log to file |
| 44 | // Only log to file if firebase.debug extension setting is true. |
| 45 | // Re-implement file logger call from ../../src/bin/firebase.ts to not bring |
| 46 | // in the entire firebase.ts file |
| 47 | const rootFolders = getRootFolders(); |
| 48 | // Default to a central path, but write files to a local path if we're in a Firebase directory. |
| 49 | let filePath = path.join( |
| 50 | os.homedir(), |
| 51 | ".cache", |
| 52 | "firebase", |
| 53 | "logs", |
| 54 | "vsce-debug.log", |
| 55 | ); |
| 56 | if ( |
| 57 | rootFolders.length > 0 && |
| 58 | fs.existsSync(path.join(rootFolders[0], "firebase.json")) |
| 59 | ) { |
| 60 | filePath = path.join(rootFolders[0], ".firebase", "logs", "vsce-debug.log"); |
| 61 | } |
| 62 | pluginLogger.info("Logging to path", filePath); |
| 63 | useFileLogger(filePath); |
| 64 | cliLogger.add(new VSCodeOutputTransport({ level: "info" })); |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Custom Winston transport that writes to VSCode output channel. |
no test coverage detected
searching dependent graphs…