Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

12345678910111213141516171819202122232425262728293031323334
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.command = void 0;
  4. const opn = require("open");
  5. const qs = require("querystring");
  6. const command_1 = require("../command");
  7. const error_1 = require("../error");
  8. const cloudlogging = require("../gcp/cloudlogging");
  9. const functionsLog = require("../functions/functionslog");
  10. const projectUtils_1 = require("../projectUtils");
  11. const requirePermissions_1 = require("../requirePermissions");
  12. exports.command = new command_1.Command("functions:log")
  13. .description("read logs from deployed functions")
  14. .option("--only <function_names>", 'only show logs of specified, comma-seperated functions (e.g. "funcA,funcB")')
  15. .option("-n, --lines <num_lines>", "specify number of log lines to fetch")
  16. .option("--open", "open logs page in web browser")
  17. .before(requirePermissions_1.requirePermissions, ["logging.logEntries.list", "logging.logs.list"])
  18. .action(async (options) => {
  19. try {
  20. const projectId = (0, projectUtils_1.needProjectId)(options);
  21. const apiFilter = functionsLog.getApiFilter(options.only);
  22. if (options.open) {
  23. const url = `https://console.developers.google.com/logs/viewer?advancedFilter=${qs.escape(apiFilter)}&project=${projectId}`;
  24. opn(url);
  25. return;
  26. }
  27. const entries = await cloudlogging.listEntries(projectId, apiFilter, options.lines || 35, "desc");
  28. functionsLog.logEntries(entries);
  29. return entries;
  30. }
  31. catch (err) {
  32. throw new error_1.FirebaseError(`Failed to list log entries ${err.message}`, { exit: 1 });
  33. }
  34. });