MCPcopy Create free account
hub / github.com/firebase/firebase-tools / logSetup

Function logSetup

firebase-vscode/src/logger-wrapper.ts:38–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36 * Logging setup for logging to console and to file.
37 */
38export 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.

Callers 1

activateFunction · 0.90

Calls 4

useConsoleLoggersFunction · 0.90
getRootFoldersFunction · 0.90
useFileLoggerFunction · 0.90
addMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…