Skip to content

Commit 8cd088b

Browse files
authored
Functions Log: add better handling for unknown values (#1377)
* add better handling for unknown values fixes #1343 * entry for fixing functions:log
1 parent 62a7fcb commit 8cd088b

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
* Set FIRESTORE_EMULATOR_HOST env var in "emulators:exec".
2+
* Fixes bug in printing Function logs when the text payload was undefined.

src/commands/functions-log.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ module.exports = new Command("functions:log")
4646
const entry = entries[i];
4747
logger.info(
4848
entry.timestamp,
49-
entry.severity.substring(0, 1),
50-
entry.resource.labels.function_name + ":",
51-
entry.textPayload
49+
_.get(entry, "severity", "?").substring(0, 1),
50+
_.get(entry, "resource.labels.function_name") + ":",
51+
_.get(entry, "textPayload", "")
5252
);
5353
}
5454
if (_.isEmpty(entries)) {

0 commit comments

Comments
 (0)