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

Function findAvailableLogFile

src/logger.ts:126–148  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

124}
125
126export function findAvailableLogFile(): string {
127 const candidates = ["firebase-debug.log"];
128 for (let i = 1; i < 10; i++) {
129 candidates.push(`firebase-debug.${i}.log`);
130 }
131
132 for (const c of candidates) {
133 const logFilename = path.join(process.cwd(), c);
134 try {
135 const fd = fs.openSync(logFilename, "r+");
136 fs.closeSync(fd);
137 return logFilename;
138 } catch (e: any) {
139 if (e.code === "ENOENT") {
140 // File does not exist, which is fine
141 return logFilename;
142 }
143 // Any other error (EPERM, etc) means we won't be able to log to
144 // this file so we skip it.
145 }
146 }
147 throw new Error("Unable to obtain permissions for firebase-debug.log");
148}
149
150export function tryStringify(value: any) {
151 if (typeof value === "string") {

Callers 1

useFileLoggerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…